I've bumped into this question because I actually wanted to define a default goal in pom.xml. You can define a default goal under build:
<build>
<defaultGoal>install</defaultGoal>
...
</build>
After that change, you can then simply run mvn
which will do exactly the same as mvn install
.
Note: I don't favor this as a default approach. My use case was to define a profile that downloaded a previous version of that project from Artifactory and wanted to tie that profile to a given phase. For convenience, I can run mvn -Pdownload-jar -Dversion=0.0.9
and don't need to specify a goal/phase there. I think it's reasonable to define a defaultGoal
in a profile which has a very specific function for a particular phase.