views:

150

answers:

7

I am looking for an lightweight Java build tool. As light as possible. Even at the expense of features. Any recommendations?

+1  A: 

There are only really two choices: Ant or Maven.

Ant is essentially a scripting tool that you can do anything with but you have to write everything yourself.

Maven comes with a lot of predefined project types. It will dictate a directory structure to you (which some people don't like) but will also handle dependencies (which Ant can sorta do with Ivy).

Personally I prefer Maven. A few lines of XML will get you the tasks to run unit tests, stop and start a Web container (eg Jetty or Tomcat), etc.

cletus
There *are* more choices, such as Buildr (http://stackoverflow.com/questions/1015525/why-use-buildr-instead-of-ant-or-maven), albeit not as popular as Ant or Maven.
Jonik
There is also Gradle at http://gradle.org/
Chris Dail
+1  A: 

I'd again recommend Maven2 - it is very feature rich through the use of plugins, but it can also be very "light" (depending on what that means):

  • it doesn't need hard installation (just unzip directory + add the path to it to the environment variables (depending on OS))
  • it doesn't require configuration - just copy-paste a simple POM file and your build is ready. You will just have to follow the directory structure conventions of maven
  • it has a plugin for every IDE, so using it with GUI makes it even easier.

Of course, an alternative is ant, but I find it less "light". And I find it less light, because ant scripts grow ugly and unpredictable, and become hard to manage, while maven scripts stay simple, because of the rich functionality provided with the tool.

Bozho
Interesting. I was under the impression that ant is "lighter" than Maven. Maybe I was wrong..
Oleg
@Oleg, many would claim Ant *is* "lighter"... Also check http://stackoverflow.com/questions/861382/why-does-maven-have-such-a-bad-rep to learn more of Maven's pros and cons.
Jonik
The lightness of Maven is that you don't need to include the nitty-gritty details. OTOH, it is "heavy" in the senses that you typically address more problems with Maven than with Ant, ... and you need to (re-)structure your project "the Maven way".
Stephen C
yes, I said _I_ find it less light.
Bozho
+1  A: 

As said elsewhere, your real choice is between maven or ant. To echo other sentiments, I find there is more configuration to do with ant, so I prefer maven. That said, a lot of people tend to criticise maven in that although you need less configuration, it downloads a lot of dependencies (and dependencies/ dependencies), so it all depends on what you mean by "light" - do you mean light in configuration or light in dependency jar downloads/installation size?

If you want something light in terms of config and downloads, you are better off with a shell script, but that will only be as feature-rich as you have time to make it!

James B
Rather then going to shell script, you can use 'Rake' under jruby. The coming JRuby 1.5 will have integrated Rake and Ant support, meaning you can call Rake task from Ant and vice-versa. So you can get the simplicity and power of Rake, but you can leverage your existing Ant build script. Checkout this blog on it: http://www.engineyard.com/blog/2010/rake-and-ant-together-a-pick-it-n-stick-it-approach/
DJ
@DJ I have to admit to being a JRuby virgin, although I am JRuby-curious...so Rake (and other tools) are making it look more and more interesting. Presumably one can use any of the many ant tools on the output?
James B
+2  A: 

As light as possible? That must be javac running from within a batch file or shell script.

But why?

Thorbjørn Ravn Andersen
+1  A: 

It really depends on your definition of 'light'. Do you want a tool that requires very little work to use (light on code)? If so, Maven or Gradle might be a good option. Maven has been around for a while. If you are doing something that follows their conventions, then you will need to write very little in your pom.xml files. If you start deviating from the norm it can get difficult to make it do what you need (making things less light). Gradle is also an option. It hasn't be around as long as Maven, but allows you to deviate from the convention easier.

If you are looking for something that is light in terms of the tools itself being lightweight, Apache ant may be a better option. It doesn't have the conventions built in like Maven. If you have a non-standard build that is pretty simple it might be possible to create a very light ant script to do your build.

Chris Dail
A: 

Maven is simplest if you follow its directory structure. If you are on linux or unix system, I would use shell script. Or you could consider IDEs eclipse or netbeans, they will do the job for you, and dependencies are very easy to configure.

chinmaya
A: 

Have you tried BlueJ (http://www.bluej.org/) ?. I used it a few years ago to teach students. It is simple in the sense you can just copy/paste code and run it. It was created to teach students, hence is very simple and good for java starters. Note that it is is a full IDE, not a command line tool like maven or ant.

rrhh