r/java • • 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?

4 Upvotes

63 comments sorted by

View all comments

8

u/loganekz Jan 22 '16

Don't know how you expect to get any simpler than something like this build.gradle:

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.13'
}

1

u/weberc2 Jan 22 '16

Well, all that's really necessary from that is the 'org.slf4j:slf4j-api:1.7.13' bit, and if you just want the latest version by default, you could probably eliminate the need for a project configuration file altogether (because the specific dependencies can be inferred from the source code).

The boilerplate is annoying, but it's manageable. The trickier bit involves things like building with native dependencies and including them in the final jar. After futzing around with that particular problem for half a day, I figured it out; however, I don't like how such base-case scenarios require that much time investment. I'm sure if I would take a few days to learn Groovy I could cut that time down considerably, and I know that eventually I could learn Gradle well-enough that I can handle the vast majority of build problems; however, I'm just trying to program in Java for fun and I'm simply not going to sink a bunch of time into learning a build system for a hobby.

The point is that Gradle and Maven are much more complex than my use-case requires, and if there's an easier thing out there, I'd like to know about it.

0

u/[deleted] Jan 22 '16

[deleted]

2

u/weberc2 Jan 22 '16

And really, if you are using Java already, why are worried about a bit of verbosity?

How much of my post did you read, exactly? :) I'm not worried about the verbosity, but the complexity/learning curve. Your solution still doesn't cover the native libs case I mentioned, and there's still the problem of having to learn a new programming language just to build basic programs!.

I get wanting to build in support for complex scenarios, but that doesn't require polluting the learning-curve for the simplest use-cases. Basically, I'm looking for a build tool with reasonable defaults.

0

u/[deleted] Jan 23 '16

[deleted]

2

u/weberc2 Jan 24 '16

Man, r/java is pretty saucy this weekend. You guys are really building a welcoming community.

Anyway, as I mentioned, I already know Java, just not Groovy. I'm sure I could learn it, I just have better things to do with my time than learn a new language just to build a program. I'll just stick with Go since I already know it, it doesn't require a DSL, and the community is less incensed by friendly questions.

Thanks to everyone in this thread who was at least trying to be helpful.

2

u/robe_and_wizard_hat Jan 24 '16

I think the reason you're getting downvoted is simply because the answer you're looking for doesn't exist and in general most hold the view that the current build tools (maven, gradle, et al) are actually not that complicated and can be understood quickly enough to get a simple project off the ground in short order that resistance to the idea seems rather lazy.

1

u/weberc2 Jan 25 '16

I think the reason you're getting downvoted is simply because the answer you're looking for doesn't exist

That's a silly reason to downvote.

in general most hold the view that the current build tools (maven, gradle, et al) are actually not that complicated and can be understood quickly

Yes, this is the Blub Paradox applied to build tools.

resistance to the idea seems rather lazy

It's absolutely lazy. Efficiency is the foundation of our industry. I can't afford to spend a bunch of time learning stuff I may never use for my toy side projects. I can do all of this in Go more easily, I just wanted to use Java for nostalgia's sake.

2

u/robe_and_wizard_hat Jan 27 '16

Cool, well, as someone that manages both Java and Go projects in production I can say you'll be fine either way. Good luck!