这应该很简单。
问题
上下文
科学计划
另一个呢
数学专题
假设科学项目依赖于数学项目,我同时在两个项目中进行开发。数学项目是一个核心产品,在生产中,如果我不太修改代码,生活会更轻松。
目前,我正在调试这两个项目之间的交互。为了帮助实现这一点,我正在编写一个方面(在科学项目中)来记录数学代码(和科学代码)执行时的关键信息。
例子
我运行了一个简单的示例方面:
package org.science.example;
public aspect ScientificLog {
public pointcut testCut() : execution (public * *.*(..));
before() : testCut() {
//do stuff
}
}
问题
问题是,无论我创建什么切入点,它都只建议
科学计划
. 没有来自的类
org.math.example
都是横切的!
我试着添加
数学专题
到
的
科学计划
去
proect properties > AspectJ Build > Inpath
然后点击
添加项目
数学专题
. 这不管用,但似乎我需要按照这些思路做点什么。
提前谢谢你的建议。。。
-gMale公司
编辑1:
写这篇文章之后,我注意到这个项目出现了以下错误:
Caused by: org.aspectj.weaver.BCException: Unable to continue, this version of AspectJ
supports classes built with weaver version 6.0 but the class
com.our.project.adapter.GenericMessagingAdapter is version 7.0
when batch building BuildConfig[null] #Files=52 AopXmls=#0
所以,也许这是正确的设置和错误是更微妙的。顺便说一句,所提到的课程可以说是来自“科学计划”。即使在我清理完项目之后也会发生这种情况。我正在搜索这个错误。。。
我找到了解决上述错误的方法
comment #5 here
问题是maven aspectj插件的pom文件声明了对aspectjtools版本1.6.7的依赖。因此,在配置插件时,必须修改临时依赖关系。以下是pom文件的相关代码段,通过指定版本1.6.9而不是1.6.7来修复问题:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.9</version>
</dependency>
</dependencies>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>