【发布时间】:2011-12-20 04:00:41
【问题描述】:
我正在尝试在具有多个模块的项目中使用 aspectj maven 插件。按照此链接中给出的说明http://mojo.codehaus.org/aspectj-maven-plugin/weaveJars.html
我正在使用@Aspectj 注释。我的方面是在一个单独的 maven 模块中,称为
artifactId - 消费者
而我要拦截或建议其方法的类在
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:compile {execution: default}] [INFO] 加入点 'method-execution(void 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) 之前来自 'com.home.demo.ods.app.OdsConsumer' (OdsConsumer.java:38) 的建议
但在执行应用程序时,它不工作。方面没有被调用。 我无法理解我是否遗漏了什么。
我也很困惑上面显示的插件配置应该在哪个模块消费者(我的方面在哪里)还是生产者。
【问题讨论】:
标签: aspectj