You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jeroen Leenarts <je...@gmail.com> on 2007/06/12 14:17:19 UTC
[mojo] How to execute logic once for several projects..
Hi,
I have the following usecase:
"Run a mojo to collect generated reports from all other modules and combine
these into one big report."
This involves collecting a number of XML files which will be combined into
one file, but that's not the problem. Just a matter of retrieving output
directories by means of the expression ${reactorProjects}.
The problem is how to influence the actual moment of execution of a MOJO.
I've got a couple of approaches that might work, but each of them pose some
kind of problem.
Here are my ideas:
-Execute a mojo on all modules, monitor the build order and when the last
project being built is active, run my reporting.
PROBLEM: How to detect which project is the last project being built?
-Execute a mojo only on the multi-project pom which uses the @aggregate
annotation.
PROBLEM: The @aggregate does not seem to force a mojo to be ran once. The
mojo is inherited to a child POM and gets executed. (I have a small demo
running demonstrating this behaviour.)
PROBLEM: How to force the execution of the parent POM to be last? In my
mind this is impossible to achieve when using parent-child relations between
multimodule projects and individual modules due to ordering imposed by
inheritance.
-Configure an extra project, depending on all other projects, which will
force this project to be executed last and configure my collecting MOJO on
that.
PROBLEM: This seems fragile to me because it is important to update this
pom everytime anything changes.
Any ideas about what I could do? If my usecase isn't entirely clear, please
let me know. I'll try to elaborate.
Regards,
Jeroen