将 AspectJ 文件导入另一个(正常)Java 项目
Importing AspectJ file into another (normal) Java project
我想构建一个名为 test5 的(普通)Java 应用程序和一个名为 test4 的 AspectJ 应用程序来监视其他 Java 应用程序,但是当我尝试将 Java 项目包含到其中时AspectJ 项目它显示构建路径错误:
- 项目未构建,因为它依赖于 test4,构建路径错误。
- 在项目 'test4' 的构建路径中检测到循环。该周期由项目 {test4, test5} 组成。
- 在项目 'test5' 的构建路径中检测到循环。该周期由项目 {test4, test5} 组成。
这里参考的是普通项目test5的代码
主要class
package test5;
public class ert {
public static void main(String[] args) {
// TODO Auto-generated method stub
yxc a = new yxc();
a.dfg(2);
}}
yxcclass
package test5;
public class yxc {
public void dfg(int a){
System.out.println(a);
}
}
这里是另一个项目test4中AspectJ文件的代码
package test4;
import test5.*;
public aspect dgf {
pointcut dff() : call(void test5.yxc.dfg(int));
before(): dff(){
System.out.println("adada");
}}
感谢任何帮助,谢谢。
该错误是由于您在eclipse 中的项目之间存在循环依赖,例如test4
取决于 test5
取决于 test4
。通过移除 test5
对 test4
的依赖来打破循环,并确保你的 test4
AspectJ 项目编织它的依赖 test5
,否则方面将无法工作。
我想构建一个名为 test5 的(普通)Java 应用程序和一个名为 test4 的 AspectJ 应用程序来监视其他 Java 应用程序,但是当我尝试将 Java 项目包含到其中时AspectJ 项目它显示构建路径错误:
- 项目未构建,因为它依赖于 test4,构建路径错误。
- 在项目 'test4' 的构建路径中检测到循环。该周期由项目 {test4, test5} 组成。
- 在项目 'test5' 的构建路径中检测到循环。该周期由项目 {test4, test5} 组成。
这里参考的是普通项目test5的代码
主要class
package test5;
public class ert {
public static void main(String[] args) {
// TODO Auto-generated method stub
yxc a = new yxc();
a.dfg(2);
}}
yxcclass
package test5;
public class yxc {
public void dfg(int a){
System.out.println(a);
}
}
这里是另一个项目test4中AspectJ文件的代码
package test4;
import test5.*;
public aspect dgf {
pointcut dff() : call(void test5.yxc.dfg(int));
before(): dff(){
System.out.println("adada");
}}
感谢任何帮助,谢谢。
该错误是由于您在eclipse 中的项目之间存在循环依赖,例如test4
取决于 test5
取决于 test4
。通过移除 test5
对 test4
的依赖来打破循环,并确保你的 test4
AspectJ 项目编织它的依赖 test5
,否则方面将无法工作。