我正在尝试将AspectJ与Intellij一起使用。我在intellij,Aspectj
和Spring AOP/@Aspectj
中启用了Support Aspectj
个插件,并在ajc
中设置了Setting -> java compiler -> ajc
编译器。
我收到此错误消息。
AspectJ Support
IDEA was unable to find AspectJ compiler .jar among plugin dependencies.
Please fix <aspectj-maven-plugin> in '/home/manoj/stuff/moghul/Git_backend/dropwizard/pom.xml' and re-import a project,or set compiler manually via Settings | Compiler | Java Compiler.
这是我的pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-graphite</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-annotation</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>io.astefanutti.metrics.aspectj</groupId>
<artifactId>metrics-aspectj</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.8</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>io.astefanutti.metrics.aspectj</groupId>
<artifactId>metrics-aspectj</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:1)
也许使用插件版本也是有意义的。我在你的POM中看不到任何东西。或者你在pluginManagement
部分定义一个?只需修复您的POM和IntelliJ IDEA即可。
顺便说一下:
aspectjrt
。如果您希望AspectJ Maven插件升级其AspectJ版本,请在所需的aspectjtools
版本上定义插件依赖项,而不是模块依赖项。如果您不完全理解这个答案,请随时提出后续问题。