views:

195

answers:

3

Hello SO,

After a recent juggling with our ant scripts I've started to wonder if something better is possible.

I need a builder that will know to recompile all required .java files for me.

For ex. for this structure

public class A { ]
public class B extends A {}
public class C {
    B b;
}
  1. For: Compile('C') Will know to compile A, B, C.
  2. For: B changed, Compile('C') will know to recompile just B.

I know of several alternatives, Ivy which seems like an extension of ant which is our current java builder. Scons which we are currently using for building C++ code, scons is excellent in doing the above described behavior for C code. Then there are reports of Maven being almost but not quite there.

What would you suggest? What tools are you using Free Software / Commercial for you build system?

Thank you, Maxim.

A: 

maven, both for my personal and my commercial products

dfa
A: 

In your question you describe inter-class dependencies. Most build systems, in particular Maven, are aimed more at inter-project dependencies. I believe most systems just recompile all the classes in a project and most of the benefits of these build systems is in building as few projects as possible.

Both Maven and Ivy will allow you to easily specify both external and internal dependencies of your project, including which version of the project you depend on. They will both also automatically download external libraries (such as apache commons) to your local machine as part of the build process if they are not already locally cached, saving a lot of work manually downloading and organizing third party jar files.

Ivy is an extension of ant, like you mention. I recommend Maven. It is a convention oriented build system that I've used successfully and feel is quite mature. Maven requires far less up front effort to start using and is quite extensible.

Joe
re: ivy vs maven: For starting a new project, I agree that Maven requires less up-front effort. For existing projects (such as this one), Ivy can be simply "plugged in", whereas Maven will usually require *more* initial effort to adjust to its expectations. This is the blessing and curse of demanding adherence to convention.
Zac Thompson
+1  A: 

None of ivy, scons or maven will help you with your problem as stated.

  1. What do you mean by "for Compile('C')"? I don't think this is what you have in your ant file.
  2. For this case, Ant should be working as desired: you have described its default behaviour. In the same javac element, Ant will only recompile changed classes. See the Ant manual entry for the javac task, especially the 'includeDestClasses' attribute.

You should probably post an example ant file that you are finding inadequate.

Zac Thompson