本文介绍了由于缺少tools.jar,Maven AspectJ插件无法使用Java 9进行构建.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将JDK版本从8切换到了9,由于缺少tools.jar,AspectJ插件不再起作用:
I switched my JDK version from 8 to 9 and the AspectJ plugin no longer works due to missing tools.jar:
目标org.codehaus.mojo:aspectj-maven-plugin:1.10的执行默认值:编译失败:插件org.codehaus.mojo:aspectj-maven-plugin:1.10或其依赖项之一无法解析:在指定的路径C:\ Program Files \ Java \ jdk-9.0.1/../lib/tools.jar
我知道从Java 9 JDK中删除了tools.jar(和rt.jar).我想知道是否有一种方法可以使Maven AspectJ插件在不使用tools.jar的情况下与Java 9一起使用?
I understand that tools.jar (and rt.jar) were removed from Java 9 JDK. I am wondering if there a way to get Maven AspectJ plugin to work with Java 9 without tools.jar?
这是我的插件定义,其中包含版本信息:
Here is my plugin definition with version info:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<complianceLevel>1.9</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<XnoInline>true</XnoInline>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.0.RC2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.0.RC2</version>
</dependency>
</dependencies>
</plugin>
推荐答案
使用快照构建代替:
<groupId>com.github.m50d</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11.1</version>
这篇关于由于缺少tools.jar,Maven AspectJ插件无法使用Java 9进行构建.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!