Community
Participate
Working Groups
See https://stackoverflow.com/questions/30877407/why-is-aspectj-weaving-aspects-from-my-test-folder-into-my-source-classes-as-op Example at: https://github.com/benze/aspectj-maven-plugin-defect-example
Beside description and runnable example already provided, this is what I use now to get the build do the right thing so that I can deploy from Eclipse, but then the IDE is shows error in my *.AJ file about the 'field' and 'method' I have added to existing class: <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <executions> <execution> <id>default</id> <!-- Compile and weave aspects after all classes compiled by javac --> <phase>process-classes</phase> <goals> <goal>compile</goal> </goals> <configuration> <showWeaveInfo>true</showWeaveInfo> <verbose>true</verbose> <includes> <include>**/*.class</include> <include>**/*.java</include> <include>**/*.aj</include> </includes> <Xlint>cantFindType=ignore</Xlint> <weaveDependencies> <weaveDependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </weaveDependency> </weaveDependencies> <weaveDirectories> <weaveDirectory>${project.build.directory}/classesToWeave </weaveDirectory> </weaveDirectories> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.2</version> <executions> <execution> <id>unpack69</id> <phase>generate-sources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <verbose>true</verbose> <artifactItems> <artifactItem> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <type>jar</type> </artifactItem> <artifactItem> <groupId>com.exigen.ipb.asynctasks</groupId> <artifactId>ipb-async-tasks</artifactId> <type>jar</type> </artifactItem> </artifactItems> <overWrite>true</overWrite> <outputDirectory>${project.build.directory}/classesToWeave </outputDirectory> <includes>**/*.class</includes> </configuration> </execution> </executions> </plugin> </plugins> <pluginManagement> <plugins> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId> org.codehaus.mojo </groupId> <artifactId> aspectj-maven-plugin </artifactId> <versionRange> [1.7,) </versionRange> <goals> <goal>compile</goal> </goals> </pluginExecutionFilter> <action> <execute> <runOnIncremental>true</runOnIncremental> <runOnConfiguration>true</runOnConfiguration> </execute> </action> </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-dependency-plugin </artifactId> <versionRange> [2.0,) </versionRange> <goals> <goal>unpack</goal> </goals> </pluginExecutionFilter> <action> <execute> <runOnIncremental>false</runOnIncremental> <runOnConfiguration>true</runOnConfiguration> </execute> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement>