tags:

views:

146

answers:

3

The past week or two I've been studying Maven, and I like it, but there are just a few things that I require Ant tasks for, rather than Maven's complicated and scarcely-documented POM file. However, I believe Maven has a great folder structure going for it, and I like that it natively supports tests, packages the project into a jar by default, and supports a 'resources' folder, from which everything is directly copied into the jar file.

Is there a sample Ant project out there that does the same sort of thing but with an Ant build.xml script? I want the placeholder folders and hello world app and test, just like Maven does when you first create a project from its default archetype:create goal (as demonstrated in the Maven in 5 Minutes page). Or, is there an even better Ant sample project out there that does more or suggests a better folder layout?

If no such thing exists, perhaps someone can help create it in a nice detailed answer? I would be willing to host a permanently-available zip file for anyone who finds this question in the future.

+2  A: 
mvn archetype:create
mvn ant:ant

http://maven.apache.org/plugins/maven-ant-plugin/usage.html

... but if there are really "just a few things", you may want to check out the AntRun plugin instead. I'm not trying to sell you on Maven, believe me, but since it's not clear exactly what is stopping you from trying it with your project, I guess I'm suggesting you try to push the issue a little harder.

Zac Thompson
A: 

Quoting the Maven - Frequently Asked Technical Questions and more precisely:

How can I use Maven features in an Ant build?

The Maven Ant Tasks allow many of the features of Maven, such as dependency management and repository deployment, to be used in an Ant build.

Refer to the installation page and the usage page for instructions for installing and using the Maven Ant Tasks respectively. You'll find many links to samples in the usage page and a build.xml showing most of the features in action.

An alternative (direct competitor?) to Maven Ant Tasks would be Apache Ivy.

PS: While it's definitely a good idea to adopt maven standards, even partially, I'd really think about it twice before to drop Maven (but I live in the Maven jungle for a while now - and I like it - so I'm biased).

Pascal Thivent
+1  A: 

Refer this: Why you should use the Maven Ant Tasks instead of Maven or Ivy

I also wouldn't recommend Ivy, reasons at the link above.

Peter Thomas