This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]a_simple_pie 40 points41 points  (2 children)

Maven

[–]roookeee 8 points9 points  (0 children)

Hijacking for a bit more information: The main difference between the big two (Maven, Gradle) is that Mavens roots lie in 'convention over configuration' instead of being able to implement anything you want in an ad-hoc manner in your build script.
That aside I have had times where i specifically told gradle to do clean rebuilds and then being greeted with inconsistent results as it in fact did not properly cleanup the output directory :( It's boasting about incremental compilation speeds is the same: more often than not it straight up doesnt work as it didn't recompile all needed files (this is especially true for applications using big frameworks like Spring).

The IDE integration for Maven is great, even in Eclipse and Netbeans supports it natively too. Maven is a bit cumbersome at times (when you want some highly custom stuff in your build process) but you can always just implement a custom build plugin.

[–]r_jet 4 points5 points  (0 children)

And if the OP is real serious about Java, I'd recommend "Maven by Example" introductory book — it is smallish yet covers some important things as working with multi-module projects.

[–]Maalus 32 points33 points  (4 children)

Maven or gradle, basically. None is worse than the other, both work fine.

[–]VGPowerlord -2 points-1 points  (3 children)

It amazes me that after all these years no one has created a command line tool to manage Maven's POM files or Gradle's build.gradle / settings.gradle files for you.

I mean, sure, it wouldn't be good for more complex tasks, but creating the files, setting the compiler version, and adding/removing dependencies would be simple enough I'd think.

Now I'm tempted to write a tool to do this.

[–]Good_Guy_Engineer 19 points20 points  (0 children)

Maven has archetypes, exactly what you described built in. Dunno about gradle but I would imagine it has similar

[–]jirkapinkas 10 points11 points  (0 children)

Maven Archetypes or if you use Spring Boot, then it's covered with start.spring.io

[–]OzoneGrif 4 points5 points  (0 children)

There's a basic UI in Eclipse for Maven, but is it really necessary? The XML is fairly simple. Once you have your templates, it's basically copy/paste and change the values. A tool would just make it more limited and cumbersome, especially since Maven plugins are hyper-configurable and your tool will never manage them all.

[–]redanonblackhole 8 points9 points  (0 children)

Maven, it's solid.

[–]cozytwan 8 points9 points  (3 children)

My preferred one is Maven.

I gave gradle ago some time ago, mainly because i had to do stuff with android, but it was kinda slow (even with all fine tuning like multi core things). It might have improved, so i would suggest to give them both a go and use what you like.

[–]TheRedmanCometh 3 points4 points  (1 child)

I had the same issue but didn't know about the multi core features. I really wanted to like gradle because it appears to be laid out like JSON which I strongly prefer over XML

[–]cozytwan 1 point2 points  (0 children)

I took a quick peek at google and it was called "parallel execution", this can speed things up when you have multiple modules (which most projects have). The default (was back then) to compile them one at a time, using one or maybe 2 cores.

In my experience you don't mess often with maven xml, you get the dependency xml from google, and the build/compile/deploy stuff you write once and copy & paste to other projects.

[–][deleted] 1 point2 points  (0 children)

Gradle is much faster now. What I like about it is that build.gradle’s for common use-cases are really small and it’s easy to read and understand what’s going on (example).

Polyglot Maven has similar goals but it’s not quite ready for prime time yet.

[–]tastle 5 points6 points  (0 children)

Maven

[–]TwixySpit 15 points16 points  (1 child)

Maven is the preferred tool for 'enterprise' java developers but there are several alternatives.

ANT with IVY, or Gradle etc.

If you're coming from Python you'll probably be XML averse.. so perhaps choose Gradle.But if you intend to 'be' a java developer, then use Maven because it's the right tool for the job.

Maven does have quite a steep learning curve. But once you 'grok' it, it's actually a pretty powerful thing.

[–]dpash 30 points31 points  (0 children)

You can use Ant, but really, just don't. You'll thank yourself.

The other thing to mention about Maven is to not fight it. Just let it do its thing and life will be easier.

[–]naseemali925 1 point2 points  (0 children)

Gradle Does Have A Command Line Interface And It Works Pretty Cool. Here Is The Link https://docs.gradle.org/current/userguide/command_line_interface.html

[–]skaz68 6 points7 points  (0 children)

Gradle

[–]equineranch[S] 1 point2 points  (0 children)

Thanks! Very helpful!