I have a project that has multiple maven modules, one of which, contains my aspects. How can I take the aspects and weave multiple maven modules? The documentation for the Aspec
I think the mechanism is explained pretty well on this page:
Using Aspect Libraries
Basically:
You put all your aspects in one project, compile it using the aspectj-maven-plugin, add a dependency to this project to all projects you want to weave and also add this config to the woven projects:
org.codehaus.mojo
aspectj-maven-plugin
1.3
your.aspects.groupId
your.aspects.artifactId
compile
The ugly part is: you need to add this configuration to every project, so one possibility would be to use a parent pom. Unfortunately, it would have to be at the same level as the aspects project (because a pom can't define a dependency to a project below it), so you'd have something like this
------- root --------
/ \
aspects -------- java-parent ----
/ / | | \
java1 java2 java3 java4 java5
or even like this
------- root ---------
/ \
aspect-parent --- java-parent ---
/ \ / | | \
aspects1 aspects2 java1 java2 java3 java4
You'd add both the
and the aspectj plugin configuration to the pom of the java-parent project