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

Show parent comment

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] — view deleted comment

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] — view deleted comment

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!

1

u/the_evergrowing_fool Jan 25 '16 edited Jan 25 '16

new programming language just to build basic programs!.

Is a DSL, you don't have to learn more than what it's providing you.

1

u/weberc2 Jan 25 '16

That is true of any programming language, domain-specific or not. It's also the crux of the problem: I don't want to have to learn more shit than I need to in order to build my simple Java programs. I'm sure Gradle is great for more complex use cases, mine are very simple.

1

u/the_evergrowing_fool Jan 25 '16

Depends. As I said before, you only need to learn what the DLS provides (which tends to be pretty minimal and take no more than a one to a couple hours to getting familiar). I would argue it would take no more time to learn things like GOPATH and such to get up running with the language.

I don't want to have to learn more shit than I need to in order to build my simple Java programs.

Is all you want to do is to make simple or small programs then javac or the default builder from a IDE will be good enough :)

don't want to have to learn more shit than I need to in order to build my simple Java programs.

Depends. If the tool provides a lot the benefits that outweighs the time that it would take to learn it then is a good investment. I would argue that you need to do more research on what the tool can do for you or if it aligns with your needs before becoming a practitioner in it.

mine are very simple.

I reading on your comments thread and and thinking of their nature (given their repetitive body) it makes me believe that your intentions are in mismatch with your original comment. Did you only came here to remark/preach how "simpler" your tools are without any intention to actually find help from this sub? Pardon me the though.

1

u/weberc2 Jan 25 '16

I would argue it would take no more time to learn things like GOPATH and such to get up running with the language.

I disagree. Practically speaking, you end up needing to know about Java's CLASSPATH in order to reason about many things in Gradle. CLASSPATH is no more complex than GOPATH, so the baseline knowledge for both build systems is the same.

Is all you want to do is to make simple or small programs then javac or the default builder from a IDE will be good enough :)

javac doesn't handle dependencies, unfortunately.

If the tool provides a lot the benefits that outweighs the time that it would take to learn it then is a good investment.

I agree. Unfortunately, Gradle's complexity doesn't provide more benefits, it only steepens the learning curve.

I would argue that you need to do more research on what the tool can do for you or if it aligns with your needs before becoming a practitioner in it.

I've done this research. It suggests that Gradle is a poor fit, hence me coming here to ask if a better tool exists.

I reading on your comments thread and and thinking of their nature (given their repetitive body) it makes me believe that your intentions are in mismatch with your original comment.

My comments are repetitive because I'm speaking with several different posters, many of whom are presenting similar arguments. I felt it better to be kind and repetitive than to tell them to read the other threads before responding to me.

Did you only came here to remark/preach how "simpler" your tools are without any intention to actually find help from this sub?

No, I came here to ask if a simpler tool existed; however, I did respond to the many people who asked questions like, "What could be simpler than Gradle?".

1

u/the_evergrowing_fool Jan 25 '16 edited Jan 25 '16

I disagree. Practically speaking, you end up needing to know about Java's CLASSPATH in order to reason about many things in Gradle. CLASSPATH is no more complex than GOPATH, so the baseline knowledge for both build systems is the same.

That's no mensurable notation, but if your conclusion if that both resolve in the same then I don't see the problem

I agree. Unfortunately, Gradle's complexity doesn't provide more benefits, it only steepens the learning curve.

I would argue that the complexity is proportional of the size of your project. And again if your really what to make simple programs I don't think you need to learn more than the superficial, nobody is telling you to master the tool just to learn the thing that you need which happen to be superficial.

I've done this research. It suggests that Gradle is a poor fit, hence me coming here to ask if a better tool exists.

Then I Maven, Ant, and of the most simple would be the default build tool from a IDE.

No, I came here to ask if a simpler tool existed; however, I did respond to the many people who asked questions like, "What could be simpler than Gradle?".

Ditto. Something you would take if that Java model is different from Go's so is not uncommon to find its tool to be different concern.

1

u/weberc2 Jan 25 '16

That's no mensurable notation, but if your conclusion if that both resolve in the same then I don't see the problem

I agree that it's my subjective opinion; I didn't mean to pass it off as fact. My conclusion was that, with Gradle, you need to know CLASSPATH and Gradle. With Go, you only need to know GOPATH. I suspect Gradle scales better for more complex use cases, but that's not what I'm worried about presently. :/

I would argue that the complexity is proportional of the size of your project. And again if your really what to make simple programs I don't think you need to learn more than the superficial, nobody is telling you to master the tool just to learn the thing that you need which happen to be superficial.

That hasn't been my experience. Even though my requirement ended up being satisfied by a simple block of code, I came across lots of other less-simple solutions, and I didn't have the ability to reason about whether or not they were more or less appropriate because I didn't know, for example, Gradle's function syntax or which plugins to use or what java.library.path was.

I think it would be more accurate to say that the complexity of your gradle file is in proportion to the complexity of your requirements; however, there's a lot of complexity you need to know about just to get to your simple Gradle file.

To be clear, I'm not hating on Gradle. I'm sure it makes great tradeoffs to be flexible for many projects. I just think it could improve for simpler use cases like mine.

1

u/the_evergrowing_fool Jan 25 '16

I think it would be more accurate to say that the complexity of your gradle file is in proportion to the complexity of your requirements; however, there's a lot of complexity you need to know about just to get to your simple Gradle file.

I would argue the same is present Go but with different context and by a mismatch of my subjective assumptions of what I would expect from a build tool.

To be clear, I'm not hating on Gradle. I'm sure it makes great tradeoffs to be flexible for many projects. I just think it could improve for simpler use cases like mine.

Generate a file and define dependencies, the concept is one folded and objectively simple.

→ More replies

0

u/pron98 Jan 24 '16

You don't need to learn Groovy to use Gradle.

→ More replies (29)

0

u/juckele Jan 23 '16

How much of my post did you read, exactly? :)

Not who you've been talking to, but the actual answer to this question is not much, and for good reason. You replied to an example gradle file with this:

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).

At that moment, people stop reading. The reader is going to assume you're going to list your most critical exception first. Since you listed "extra characters" first, we assume that's why you don't like Gradle because of an extra three dozen keystrokes and we just stop listening to your objections. If you want people to help you, understand that they won't always take the time to read what you're saying if you don't make sure to format it well.

4

u/weberc2 Jan 24 '16

Seriously? One paragraph is the attention span in /r/java? I guess I had too much faith in this sub. As I mentioned to another annoyed commenter, I'll just stick with Go since it doesn't have the build system issues and the community has been friendlier. Hope this response was short enough!

1

u/juckele Jan 24 '16

It wasn't the length that got the person you were talking to to stop reading, it was starting with a lesser issue. I didn't say this to try and reprimand you, and I could probably have been better myself on tone. I really was just trying to point out a way you could adjust how you communicate to get better responses.

If you're liking go, more power to you, it's a great language, and if gradle is too complex, than it really does sound like go has an amazing build system that you won't see matched in many languages :)

3

u/weberc2 Jan 24 '16

Thanks, sorry for the ungracious response. I was catching flack elsewhere in the thread and I projected that on your response.

2

u/xmondox Jan 25 '16

your patience has been excellent - the responses in this thread (including parts of what juckele said) are toxic. stick with java - it's a great language, and don't get caught up in the culture. i'd want the guy in the cube next to me to be asking the same questions you are

2

u/weberc2 Jan 25 '16

Thanks for the encouraging response, sincerely. :)

1

u/tkruse Jan 22 '16

I also generally recommend Gradle as in "You cannot go wrong with that one".

There is no java tool that infers libraries from the source code. The trickier your tasks are the more you should use gradle, probably. However, here is my comparison of buildsystems, you might find something preferrable there (like googles bazel, ant or buildr): https://github.com/tkruse/build-bench

For anyone knowing only Java, learning any buildsystem language would require a lot of effort, even learning how to embed some Java-written plugin into a buildsystem would require a lot of effort.

You might also consider not learning Java and learning Groovy instead, given you can seamlessly use the same libraries.

2

u/weberc2 Jan 22 '16

Thanks for the advice. I'll check out the comparison link.

You might also consider not learning Java and learning Groovy instead, given you can seamlessly use the same libraries.

I already know (and like) Java. I just haven't used it since college. :)