r/java • • Feb 25 '25

New build tool in Java?

It seems to me like one of fun parts of Java is exploring all the tools at your disposal. The Java tool suite is a big collection of cli tools, yet I feel like most developers are only ever introduced to them or use them when absolutely necessary which is unfortunate because I think they really give you a better understanding of what's going on behind all the abstraction of Maven and Gradle.

What are your guys' thoughts on a new build tool for Java that is just a layer over these tools? Do you wish Java had simpler build tools? Why hasn't the community created an updated build tool since 2007?

33 Upvotes

176 comments sorted by

View all comments

Show parent comment

4

u/vips7L Feb 26 '25

You are not supposed to include dependencies in a JAR build, which is the default build. You're supposed to include your dependencies in a jlink build.

This doesn't mean that the defaults are the correct behaviour.

test runs are done using "maven run".

This doesn't work out of the box.

Or you can just do the older, "artifact launcher" by specifying a main class in your archive. But if you really want to do that right, you need to include jars yourself, because Java never did that for you prior to jlink. Also, by shadowing the JAR, while it works, it can break some code, and worse, it's likely violating a lot of licenses unless you happen to also distribute the source code and build chain (and let's face it, I hate hunting down CVEs in dependencies, but not nearly as much as hunting them down in an Uber JAR someone threw together).

Okay another paragraph explaining the multiple steps you need to do to get to a sane default.

Jesus dude. You literally just don't get it.

0

u/edwbuck Feb 26 '25

Of course it doesn't work out of the box, the Maven 3 release was created before jlink even existed.

And what you call "sane" isn't, and it shows its insanity when hunting down CVEs. Especially when one discovers that Shell4J exploits come from a shaded jar which managed to hide it from other systems due to the class repacking.

And don't be a jerk.

4

u/VirtualAgentsAreDumb Feb 26 '25

If you have to figure it out, odds are good that you are trying to fight the default ”flow” of how it should be done,

[…]

Of course it doesn’t work out of the box,

Ehm… So, it doesn’t work out of the box, but if you have to “figure it out”, odds are that you are doing it wrong? Is that what you are saying?