Reputation: 61
I am migrating an project from jdk8 to jdk11. in my pom.xml file, i have put
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<java.version>11</java.version>
and
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.11</source>
<target>1.11</target>
<release>11</release>
<fork>true</fork>
</configuration>
</plugin>
after running mvn clean install command, i am getting an error: Could not find artifact jdk.tools:tools:jar:1 at specified path /opt/jdk-11.0.9/../lib/tools.jar. I am aware that tools.jar is removed from jdk11. I am thinking some dependencies in my pom.xml are relying on the tools.jar, and I have not find a good solution to figure out what these dependencies are. Or It could be some other issues.
Upvotes: 0
Views: 1328
Reputation: 1562
Sometimes if this error occurs in Maven, it will totally prevent it from running, so dependency:tree
goal will also give this error.
In my case I was getting it because of an old odfdom dependency mentioned here - if you are in a similar situation you could try disabling your dependencies and enabling them one by one to see if the error goes away and at least Maven runs correctly.
Upvotes: 0
Reputation: 99
based on your above config, it is expected to get the following error:
Fatal error compiling: error: invalid target release: 1.11
I would recommend το change the source and release targets to be settled 11
not 1.11
, see the example below.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
Then using mvn dependency:tree
and mvn dependency:analyze
and/or using -X
option to debug it.
Upvotes: 0