Question

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.

Was it helpful?

Solution

  1. Ant, with 'depend' task and with 'closure' option turned on
  2. 'make', from IDEA ide

OTHER TIPS

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.

maven, both for my personal and my commercial products

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top