lindenb / jvarkit

Java utilities for Bioinformatics
https://jvarkit.readthedocs.io/
Other
485 stars 133 forks source link

Use gradle default dependency management and create shadow/fat jar by using existing tools #253

Open circlesmiler opened 1 month ago

circlesmiler commented 1 month ago

JVarKit seems to be designed as a standalone command line tool. Therefore, all dependencies are packed into the executable jar file which is exactly what you want for using it in the most simple way on the terminal. Nice. :-)

But: If you want to use JVarKit as a library in your own project you are in trouble, because all external dependencies are packed into the jar and can collide with different library versions of your project. Normally gradle would try to handle this, but it can not "see" the dependencies in the jvarkit.jar file.

Solution: Use the "normal" dependency management in your project and use existing tools that pack the external libraries into the jar.

Question: Are there any reasons why this was not done on the first place? Otherwise, I could try to provide a PR for this.

What do you think? :-)

PS: When I look into the build.gradle file there seems to be a lot of thinks going on. I could imagine that it is not possible to use this project as a library in other projects. But maybe you could explain the problem/the requirements.

lindenb commented 1 month ago

@circlesmiler Hi,

I've never been able to use/learn gradle, I must be too old.

At first the java programs were standalone and generated using a Makefile, I then moved to gradle (without really understanding it) just to handle more easily(?) the maven libraries, and later, I packaged most (but not all) programs into one 'jvarkit.jar'.

Feel free to write a standard build.gradle but I can only accept the PR if, sorry, I understand the code and if I can build side projects : eg. https://github.com/lindenb/jvarkit/blob/3b819492487bb9375fd9ceb07f83663860c38875/build.gradle#L1943

P.

circlesmiler commented 1 month ago

@lindenb Well... that is totally understandable. Thanks for the explanation and your openness.

I used gradle a lot in "normal" Java projects but also on a "normal" complexity. :-) I will discuss this with my team. I think there are some good arguments for helping out. Normally, it should be much more maintainable. But I also understand that gradle is a complete "own world" of experience. :-D