I'm just curious, is there a way to specify that you want a string of goals run as the default goal in a maven project? Is there an equivalent to Ant's <project name="MyProject" basedir="." default="main"><target name="main" depends="clean,run"/>
?
views:
17answers:
2
+1
A:
No there is no such thing in Maven to define a default goal neither a target (which does not exist in Maven), cause you will call maven allways with a goal e.g. mvn clean or mvn package etc.
khmarbaise
2010-08-20 13:08:57
Well, there is something and if you use it, you can call maven without a goal e.g. `mvn`.
Pascal Thivent
2010-08-24 02:46:11
+2
A:
There is something roughly equivalent, you CAN define a default goal or phase that will be executed if none is given in the build
element:
<build>
<defaultGoal>install</defaultGoal>
...
</build>
But this has to be a single phase, or goal, you can't pass multiple phases/goals (not really a problem since a phase triggers all preceding phases).
Here is what the POM Reference writes about defaultGoal
:
defaultGoal:
the default goal or phase to execute if none is given. If a goal is given, it should be defined as it is in the command line (such as jar:jar). The same goes for if a phase is defined (such as install).
Reference
- POM Reference
Pascal Thivent
2010-08-20 15:06:19
I knew about that document, but I was hoping I had missed something...
Christopher W. Allen-Poole
2010-08-24 02:25:07