如何配置aspectj以获得编译后编织(使用maven)?

编程入门 行业动态 更新时间:2024-10-27 18:29:41
本文介绍了如何配置aspectj以获得编译后编织(使用maven)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何配置 AspectJ 以获得编译后编织?我只是在下面的插件中用后编译"替换了编译":(不用说这是不安全的)

How to configure AspectJ in order to get post-compile weaving? I just replaced "compile" with "post-compile" in the plugin below: (needless to say that was unseccessful)

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.5</version> <configuration> <complianceLevel>1.6</complianceLevel> <source>1.6</source> <target>1.6</target> </configuration> <executions> <execution> <goals> <goal>post-compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin>

但我错过了一些东西,因为它给出了以下错误:

'post-compile' was specified in an execution, but not found in the plugin

推荐答案

包含要编织的类的 JAR 文件必须在 Maven 项目中列为 并列为 <在aspectj-maven-plugin的中的code>.来自 www.mojohaus/aspectj-maven-plugin/examples/weaveJars.html:

The JAR files containing the classes to weave must be listed as <dependencies/> in the Maven project and listed as <weaveDependencies/> in the <configuration> of the aspectj-maven-plugin. From www.mojohaus/aspectj-maven-plugin/examples/weaveJars.html:

<project> ... <dependencies> ... <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.8.13</version> </dependency> <dependency> <groupId>org.agroup</groupId> <artifactId>to-weave</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>org.anothergroup</groupId> <artifactId>gen</artifactId> <version>1.0</version> </dependency> ... </dependencies> ... <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.11</version> <configuration> <weaveDependencies> <weaveDependency> <groupId>org.agroup</groupId> <artifactId>to-weave</artifactId> </weaveDependency> <weaveDependency> <groupId>org.anothergroup</groupId> <artifactId>gen</artifactId> </weaveDependency> </weaveDependencies> </configuration> <executions> <execution> <goals> <goal>compile</goal> </goals> </execution> </executions> </plugin> ... </plugins> <build> ... </project>

更多推荐

如何配置aspectj以获得编译后编织(使用maven)?

本文发布于:2023-07-15 23:13:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1115345.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:aspectj   maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!