java - AspectJ not working in maven project in IntelliJ -
i have maven project use aspectj auditing. i'm use intellij idea. here plugin config in pom file:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>aspectj-maven-plugin</artifactid> <version>1.7</version> <configuration> <showweaveinfo>true</showweaveinfo> <source>${java.version}</source> <target>${java.version}</target> <xlint>ignore</xlint> <compliancelevel>${java.version}</compliancelevel> <encoding>utf-8</encoding> <verbose>true</verbose> </configuration> <executions> <execution> <!-- important --> <phase>process-sources</phase> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjtools</artifactid> <version>1.8.10</version> </dependency> </dependencies> </plugin>
when clean package aspectj plugin says:
join point 'method-execution(java.util.list com.test.gethistories(java.lang.string, java.lang.string))' in type 'com.test.historyservice' (historyservice.java:18) advised around advice 'com.test.aspects.auditloggeraspect' (auditloggeraspect.java:88) join point 'method-execution(java.lang.string com.test.getstring(int, java.lang.object))' in type 'com.test' (aspecttest.java:14) advised around advice 'com.test.auditloggeraspect' (auditloggeraspect.class(from auditloggeraspect.java))
this app packaging war , want deploy on weblogic. when deploy or run test aspect not work. why?
i test aspect , maven plugin config in java app , it's work good.
when clean , package project maven-compiler-plugin recompile projects after aspectj-compiler-plugin compile it. compiled aspects removed. add below config maven-compiler-plugin solve it:
<plugin> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <!-- important --> <useincrementalcompilation>false</useincrementalcompilation> </configuration> </plugin>
Comments
Post a Comment