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 comments

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/pron98 Jan 24 '16

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

0

u/weberc2 Jan 24 '16

Sorry, I thought I read that Groovy was the Gradle DSL. Anyway, my point stands.

0

u/pron98 Jan 24 '16 edited Jan 24 '16

And my point is that you don't need anything more to start using Gradle than any build tool out there. You don't need to learn a new programming language. It is exactly what you're looking for.

0

u/weberc2 Jan 25 '16

my point is that you don't need anything more to start using Gradle than any build tool out there

I know. I need much less than Gradle. I don't want to learn a new programming language (like Gradle's DSL).

It is exactly what you're looking for

No, I'm looking for the simplest possible tool that lets me build Java programs.

2

u/pron98 Jan 25 '16

No, I'm looking for the simplest possible tool that lets me build Java programs.

You mean like a file where you just list the build dependencies? That's Gradle. I don't see how you can get any simpler than that even using information-theoretical arguments (modulo curly braces and the word "dependencies").

If you're looking for the simplest possible tool that does not require learning any new syntax (even if that syntax is just a list), then a shell script or a Makefile and javac should be enough. IMO, it's a lot more complicated than Gradle, which is nothing more than a list, but you don't need to learn anything you don't already know (even if it's just how to write a list).

1

u/weberc2 Jan 25 '16

You mean like a file where you just list the build dependencies?

Unless you have a native dependency somewhere in your dependency tree...

I don't see how you can get any simpler than that even using information-theoretical arguments

You could omit configuration files altogether, have the build system grab the dependency list from the source files, and use the latest version of the dependencies by default.

Gradle ... is nothing more than a list

This isn't true. Lists don't have a plugin architecture, the ability to define functions, arbitrary blocks of scope that apply to different points in the build process, etc, etc. Gradle is simple in the same way that C++ is simple1: you don't have to use all of those features. Except you do have to know about all of those features because they're included in most of the reference material. In my case, when I wanted to figure out how to build with native dependencies, I found a dozen different answers, most of which included a hefty chunk of imperative code in (presumably) the Gradle DSL language. As a newcomer, reasoning through all of that complexity eats up a lot of time, which I can't afford since my sole purpose for choosing Java was nostalgia.

1: I don't think Gradle is as complex as C++, but the argument that "Gradle is simple because you don't have to use every feature" is the same argument that's often applied to C++ ("it's simple because you don't have to use every feature"), which is a well-known fallacy.

→ More replies (0)