tags:

views:

55

answers:

5

Hi there

The best building tool for Java I know so far seems to be maven,

but it still doesn't give so much flexibility as cmake at all!

Anyone knows a cmake-alike tool for java?

A: 

This probably is a better question for stacoverflow.com, but i would recommend Ant. It's very robust and flexible.

David A.
A: 

Ant and maven are too great build tools. With maven, if you want to do custom builds, you are likely going to have to write your own maven plugin which isn't that hard. There is loads of documentation online to create your own plugin. The cool thing about making a maven plugin is that it is easy to share in an organization or with a team of developers; do share these plugins, you generally need to be hosting your own maven repo.

Ant is really quite flexible as it has a really extensive set of tags for doing just about anything including building, running tests, moving files around, checking out code from a repo, and even executing commands on a remote server. In my opinion, ant is a little easier to work with when you have to make custom builds. The problem with ant is that it is more difficult to make into a sharable module that you can share and configure like you can with a maven plugin.

Ivy is another popular build tool however, I have no experience with it.

Chris J
+1  A: 

The best building tool for Java I know so far seems to be maven, but it still doesn't give so much flexibility as cmake at all!

That might be true, but I'd ask if you really need that "flexibility". Part of maven's biggest value is that it standardizes development. The way source/resources, dependency are managed, well defined life-cycles etc. etc.

It is because of this standardization that you can hook up build servers, IDEs, automated test tools and many more tools easily. Also importantly, new developers find it easier to get familiar with the code base because they know what structure to expect.

Those benefits would be lost if you have a "flexible" build, however, are you really going to gain anything from having such a "flexible" build? A LOT of people are using maven, and for almost all problem they already created a solution. If you strive to use those standardized solutions, you'll have much less trouble with building IMHO.

Should you have the rare situation in which you truly need to do something that can't be done in a standardized way, you can still hook scripts/ant tasks etc into maven and even write custom plugins. But I really doubt you'd ever need to do that.

Enno Shioji
A: 

Both Maven and Ant are 100% flexible, in the sense that you can develop your own extensions if existing built-in features or plugins don't do what you need.

If you are starting a new project from scratch I'd recommend Maven as being more powerful. The downside is that you need to organize your project directories in a Maven specific way for best results.

If you have an existing Java codebase then Ant would avoid the need to reorganise your project directories. You can use it by itself, or use it in conjunction with Ivy for better dependency management.

Both Maven and Ivy are cross-platform tools. If your platform can compile and run Java, then you can use either tool. Unless you do something silly with your build files, your builds should run on any platform.

Stephen C
I think that those who are used to make-based builds see the need to learn a plugin infrastructure to extend the set of available operations already as a massive loss of flexibility.
Michael Borgwardt
Maybe we need to educate them :-). Seriously, I used make for 15+ years before using Ant, and I don't want to go back.
Stephen C
A: 

CMake has no concept of dependencies (only on dependencies of sources to object files or shared libraries) but not on the artifact level (like jar's in Java) or RPM's etc. I would call this a module dependencies. CMake does not has a concept of transitive dependencies etc. CMake has no concept of defined structure of a project (Convention over configuration). CMake has no concept of a repository (like Maven has). CMake has no support of Unit/Integration tests integrated. No defined build life cycle. CMake has no concept of Release Management (which maven has) etc.

but it still doesn't give so much flexibility as cmake at all!

What exactly do you miss here in Maven?

khmarbaise
It's funny how people can look at the same piece of reality and see completely opposite things. Maving "having a concept" of all these things is exactly what makes it less flexible: you cannot deviate from Maven't concepts or easily add new ones. Whereas CMake allows you to do absolutely anything easily, but making it all work together becomes progressively harder the more complex the build is.
Michael Borgwardt
The flexibility you are talking about makes a build in large project a mess (create a separate development project: The build), cause the more flexibility you have the more you have to maintain. Maven has enough flexibility to do it's job. There might be situations where you reach a limit, but then you can simply create a Plugin. You are saying you can do absoluteley anything easily? Hm...That means on the other hand you have to define these or similar concepts yourself first in a project and that's time consuming.
khmarbaise