它使用编译时编织在maven上对我们有效,请尝试添加以下插件:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration> <compilerVersion>1.6</compilerVersion> <fork>true</fork> <source>1.6</source> <target>1.6</target></configuration></plugin><plugin><groupId>org.prehaus.mojo</groupId><artifactId>aspectj-maven-plugin</artifactId><executions> <execution> <id>compile</id> <configuration> <source>1.6</source> <target>1.6</target> <verbose>false</verbose> <outxml>true</outxml> <aspectLibraries> <aspectLibrary> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </aspectLibrary> </aspectLibraries> </configuration> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile</id> <configuration> <source>1.6</source> <target>1.6</target> <verbose>false</verbose> <aspectLibraries> <aspectLibrary> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </aspectLibrary> </aspectLibraries> </configuration> <goals> <goal>test-compile</goal> </goals> </execution></executions><dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.6.4</version> </dependency></dependencies></plugin>
它作为两个独立的执行步骤完成,允许您添加不同的方面库以进行单元测试和编译。
您还需要为spring-aspects库添加以下依赖项:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <scope>compile</scope> </dependency>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)