maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trevor Harmon <>
Subject Are Maven profiles like Ant targets?
Date Tue, 16 Dec 2008 15:27:39 GMT
I'm coming from the Ant world, where targets are fundamental. Need to  
generate the JavaDocs and a JAR? Write targets called "javadoc" and  
"jar" then do:

   ant javadoc
   ant jar

In Maven, these particular tasks have built-in plugins, so there's no  
need to write a target. Instead you just invoke the plugin goal:

   mvn javadoc:javadoc
   mvn jar:jar

But there are many scenarios in which no plugin is available. For  
instance, I use install4j to build an installer, and I use DocBook to  
translate XML into PDF. Accomplishing these tasks with the AntRun  
plugin is easy enough, but it's not clear how to actually invoke them.  
The Ant concept of a target does not exist in Maven.

Maven does have profiles, however. I'm able to put the install4j stuff  
into a profile called "install4j" and the DocBook stuff into a profile  
called "docbook". Then I can do:

   mvn -Pinstall4j
   mvn -Pdocbook

This works, but from an end-user standpoint it's a little confusing.  
For some things you invoke a plugin goal but for other things you  
invoke a profile. It's inconsistent. Also, the Build Profiles chapter  
of the Maven book mentions nothing about this use case. It only talks  
about profiles for the purpose of build portability.

So... am I doing this right? Are profiles intended to play the role of  
Ant targets? Or is there some other mechanism for that?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message