【发布时间】:2017-02-15 00:50:20
【问题描述】:
我有一个使用 Spring AOP 的简单项目。它使用来自 AspectJ 的注释。该项目在 Maven 中,它可以使用aspectjtools-1.7.4 编译。对于aspectjtools-1.8.9,它看不到从org.aspectj.lang.annotation.Aspect 导入的接受注释@Aspect。同一个项目对 Gradle 和相同的 JAR 没有任何问题。
为什么我的代码不能与最新版本的 AspectJ 一起使用,但可以与旧版本一起使用?
我正在附加 pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>aspectjproblem</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>aspectjproblem</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<!-- WITH 1.8.9: FAILS to see org.aspectj.lang.annotation.Aspect -->
<!-- <version>1.8.9</version> -->
<!-- WITH 1.7.4: SEES OK: org.aspectj.lang.annotation.Aspect -->
<version>1.7.4</version>
</dependency>
</dependencies>
</project>
我想这一定与合规级别或类似的事情有关。谁能指出我正确的方向?非常感谢。
【问题讨论】:
-
您介意发布您看到的错误消息吗? “不起作用”有点含糊。
标签: eclipse maven dependencies aspectj revision