I have a MOJO I would like executed once, and once only after the test phase of the last project in the reactor to run.
Using:
if (!getProject().isExecut
The best solution I have found for this is:
/**
* The projects in the reactor.
*
* @parameter expression="${reactorProjects}"
* @readonly
*/
private List reactorProjects;
public void execute() throws MojoExecutionException {
// only execute this mojo once, on the very last project in the reactor
final int size = reactorProjects.size();
MavenProject lastProject = (MavenProject) reactorProjects.get(size - 1);
if (lastProject != getProject()) {
return;
}
// do work
...
}
This appears to work on the small build hierarchies I've tested with.