Reputation: 7468
I have aspectj-maven-plugin:1.11 in my pom and jdk 11 installed on my system. Jdk 11 doesn't have tools.jar in lib directory. This is causing maven build to fail with error:
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile (default) on project groundtruth-storage-writer: Execution default of goal org.codehaus.mojo:aspectj- maven-plugin:1.11:compile failed: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.11 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:11.0.7 at specified path ...\Java\jdk-11.0.7/../lib/tools.jar
How to solve this issue?
There is an answer here, but that is more than 2 years old.
Upvotes: 6
Views: 9091
Reputation: 3083
Update II (2023-03):
The MojoHaus aspectj-maven-plugin
's development seems to have stalled again. Instead, the AspectJ developers recommend switching to a different fork of the AspectJ Maven plugin, which is kept up to date with AspectJ itself. The fork's coordinates are:
<dependency>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.13.1</version>
</dependency>
Update I:
The official aspectj-maven-plugin
has been resurrected, version 1.14.0 supports JDK up to 16.
Original answer:
Unfortunately, (as of July 2020) the currect version of the "official" aspectj-maven-plugin
runs only on Java 8. There are two outstanding issues for it here and here and several PRs fixing them, but the maintainers haven't responded to any of them.
You can try switching to a different fork of the plugin, for example, Nick Wong's version:
<dependency>
<groupId>com.nickwongdev</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.6</version>
</dependency>
Upvotes: 10