If a custom goal is defined which wants to call the multiproject plugin twice with different value on
the maven.multiproject.includes property the goal multiproject:projects-init must be executed twice.
Example:
<goal name="release-ejb-client">
<!-- dummy call to init the plugin -->
<attainGoal name="maven-multiproject-plugin:register"/>
<maven:set plugin="maven-multiproject-plugin"
property="maven.multiproject.includes"
value="${my.ejb.clients}"/>
<maven:set plugin="maven-multiproject-plugin"
property="goal"
value="ejb:deploy-client"/>
<attainGoal name="multiproject:goal"/>
<!-- call the nultiproject plugin again but with a different list -->
<maven:set plugin="maven-multiproject-plugin"
property="maven.multiproject.includes"
value="${my.ejb.clients.src}"/>
<maven:set plugin="maven-multiproject-plugin"
property="goal"
value="dist:deploy-src"/>
<attainGoal name="multiproject:goal"/>
</goal>
The first list will be used in the second call to the plugin since there is a flag in multiproject:projects-init
that prevents the goal being runned twice.
What I want to add is the possibillity to force the execution of multiproject:projects-init. For instance like this:
<goal name="release-ejb-client">
<!-- dummy call to init the plugin -->
<attainGoal name="maven-multiproject-plugin:register"/>
<maven:set plugin="maven-multiproject-plugin"
property="maven.multiproject.includes"
value="${my.ejb.clients}"/>
<maven:set plugin="maven-multiproject-plugin"
property="goal"
value="ejb:deploy-client"/>
<attainGoal name="multiproject:goal"/>
<!-- call the nultiproject plugin again but with a different list
Fist force the multiproject:projects-init to be executed.
-->
<maven:set plugin="maven-multiproject-plugin"
property="mpprojectsInit"
value="false"/>
<maven:set plugin="maven-multiproject-plugin"
property="maven.multiproject.includes"
value="${my.ejb.clients.src}"/>
<maven:set plugin="maven-multiproject-plugin"
property="goal"
value="dist:deploy-src"/>
<attainGoal name="multiproject:goal"/>
</goal>
The new multiproject:projects-init will look like this:
<goal name="multiproject:projects-init">
<j:if test="${mpprojectsInit == null || mpprojectsInit == false}">
<j:set var="mpprojectsInit" value="true" />
<ant:echo>Gathering project list</ant:echo>
<maven:reactor
basedir="${maven.multiproject.basedir}"
banner="Gathering project list"
includes="${maven.multiproject.includes}"
excludes="${maven.multiproject.excludes}"
postProcessing="true"
collectOnly="true"
collectionVar="multiprojects"
ignoreFailures="${maven.multiproject.ignoreFailures}"
/>
</j:if>
</goal>
Patch to fix the improvment.