File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven Commandline Interactive Mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven Commandline Interactive Mode" Watch "Maven Commandline Interactive Mode" New topic

Maven Commandline Interactive Mode

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


I would like to acheive something like the Maven archetype-generate plugin does. I have a Maven project and I have 3 different configurations for the project. When I build this project by calling mvn clean install, I want to show to the user 3 different configuration options namely. dev, test, reference and the user selects one of the option and hits enter. This should be then given as the input to the Maven pom file and Maven builds the project for that set of configuration values. Any suggestion on any plugin that would acheive this?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Would profiles do what you are looking for:

JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

As a general rule, it's not a good idea to make either Maven or Ant scripts conversational. It can cause the build process to hang if the building person/application doesn't know that it should be chatting with the build and furthermore if there's an emergency and/or the original authors have been laid off (not uncommon these days), it's possible that whoever's trying to do the build may not know the proper responses. Of course some people would argue that that's a fitting means of revenge.

Profiles are a good alternative, as they can be supplied on the Maven command line or in a script that runs the maven command line.

For webapps, I myself don't do alternative builds except in cases like where the development machine is Tomcat and the target is something like an IBM iSeries WebSphere server. For more generic environments such as Windows, Linux, and Solaris, I put the personality information on the target server itself and let the app pick it up from there.

An IDE is no substitute for an Intelligent Developer.
subject: Maven Commandline Interactive Mode
jQuery in Action, 3rd edition