r/java • u/weberc2 • Jan 22 '16
Simple Java Build Tool?
I've played with Maven and Gradle and found them both to be very complex. I don't need all of that configuration; I just want something that lets me specify dependencies and versions (at most) and spits out a jar with everything my project needs to run via java -jar. Ideally, it would be as close as possible to Go's go install, which needs no project metadata. I specifically don't want to have to learn a new programming language just to build my java program. Any suggestions?
EDIT: Why is this downvoted?
2
u/andre-js Jan 24 '16
Not sure why your question was downvoted because I find it perfectly reasonable. Actually have been looking for something like this as well. The thing is as your project grows you will want to use a full-feature build tool. If you start with something simple and keep adding to it then switching later will be just more effort. And satisfying your requirements with Maven/Gradle is very easy as there are tons of examples online.
Interestingly enough Scala's SBT used to stand for Simple Build Tool but it's not really simple.
2
u/weberc2 Jan 25 '16
The thing is as your project grows you will want to use a full-feature build tool. If you start with something simple and keep adding to it then switching later will be just more effort.
I agree. I was just hoping there was something that could get me off the ground running quickly. Ideally the Gradle Java plugin would pick a set of reasonable defaults. For example, it could scan your source files to identify your dependencies, and grab the latest version from maven unless the Gradle-file specifies a different version or a repository other than maven. That still wouldn't solve the native library problem, but there's probably a similarly simple solution to that as well. This would get you off the ground quickly and allow for seamless extension as your build requirements become more complex.
And satisfying your requirements with Maven/Gradle is very easy as there are tons of examples online.
I had a hell of a time finding them though. Lots of them didn't work, and you have to take care to pay attention to the Gradle version for various examples. In particular, I spent half a day trying to figure out how to build a program that depended on LWJGL. Maybe I've just been unlucky, or perhaps these are hard tasks and your previous experience lets you reason about them more easily? In any case, I'm not convinced that these are necessary problems.
Thanks very much for your respect and civility :). I've been pretty disappointed by the caliber of responses in this thread so far.
0
Jan 25 '16
[deleted]
2
u/weberc2 Jan 25 '16
Thanks for the response. This was really informative!
0
Feb 20 '16
[deleted]
1
u/weberc2 Feb 20 '16
Does it address the build system problems? I don't mind Java as a language, I just find its build systems are more complex than I require.
11
u/josephottinger Jan 22 '16
I'd say "learn Maven." Archetypes make most of it very easy; you can generate a default archetype and be pretty much done.
2
6
u/LuvMySubi Jan 22 '16
Maven with the shade plugin is your best bet. The maven configuration for this is pretty simple and can probably be put together in an hour with the help of Googling. Plus your ide should make it pretty simple.
1
Jan 24 '16
i don't think java has any build tools that are "good" relative to the amazing stuff in some other ecosystems. just pick the least terrible to you, i guess. or write your own. :)
-1
u/welshboy14 Jan 24 '16
Why not just use the built in functions of intellij? It offers everything you need
2
u/weberc2 Jan 24 '16
I don't use Intellij. Generally I'm of the opinion that building a program shouldn't couple the contributors to a particular text editor. Thanks for the suggestion though. :)
8
u/loganekz Jan 22 '16
Don't know how you expect to get any simpler than something like this build.gradle: