我想在我们的项目中使用aspectj maven插件,它有多个模块。按照此链接给出的说明http://mojo.codehaus.org/aspectj-maven-plugin/weaveJars.htmlAspectJ Maven插件<weaveDependency>
我正在使用@Aspectj注释。我的方面是所谓的
的artifactId一个单独的Maven模块 - 消费者
,我想拦截还是建议是,其方法的类中
的artifactId - 制片
我在消费者模块的pom文件中添加了以下配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<showWeaveInfo>true</showWeaveInfo>
<weaveDependencies>
<weaveDependency>
<groupId>com.home.demo</groupId>
<artifactId>producer</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
在同一个pom文件中还添加了“producer”作为依赖项。
当我正在为消费者模块进行mvn clean install时,控制台中会出现以下信息。
[INFO] [AspectJ的:编译{执行:默认}] [INFO]加入点“的方法执行中(空隙com.home.demo.producer.messaging.MomServiceEndpointListener.handle(com.home.messaging .service.MessageContext,com.home.messaging.service.MessageContext))'在 中输入'com.home.demo.producer.messaging.MomServiceEndpointListener'(MomServiceEndpointListener.java:21)。 demo.ods.app.OdsConsumer'(OdsConsumer.java:38)
但是在执行应用程序时,它不起作用。该方面没有被调用。 我无法理解我是否缺少一些东西。
此外,我很困惑,上面显示的插件配置应该在哪个模块使用者(我的方面是哪里)或生产者。