Reputation: 1326
I tried building a custom Jenkins-Plugin using Maven. Here is the issue:
My project depends on org.kohsuke.args4j
(https://github.com/kohsuke/args4j). I've added the dependency in my pom.xml-file.
<dependencies>
<dependency>
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.kohsuke.args4j</groupId>
<artifactId>args4j-maven-plugin</artifactId>
<version>2.33</version>
</dependency>
</dependencies>
Apparently, this project requires somehow the tools.jar executable - which cannot be found.
[ERROR] Failed to execute goal on project commit-pipeline-xml: Could not resolve dependencies for project com.siemens.plugins:commit-pipeline-xml:hpi:0.1: Could not find artifact jdk:tools:jar:5.0 at specified path /usr/local/java/jdk-14.0.2/../lib/tools.jar
For my installation (see next paragraph) the path is wrong anyways, but I cannot even find tools.jar in /usr/local/java/jdk-14.0.2/lib/tools.jar where I would expect this file. A ls -l on $JAVA_HOME/lib
outputs some files (mostly *.so) but no tools.jar. Also find $JAVA_HOME -name "tools"
exposes nothing.
For building my project the I'm using docker with ubuntu 18.04 as base. The jdk gets installed by downloading the tar.gz from oracle.com and installing it using the commands:
mkdir -p /usr/local/java
cd /usr/local/java
tar xzvf "$JAVA_JDK_PATH"
ls -l ./jdk-$JAVA_JDK_VERSION/bin
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk-$JAVA_JDK_VERSION/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk-$JAVA_JDK_VERSION/bin/javac" 1
sudo update-alternatives --set javac "/usr/local/java/jdk-$JAVA_JDK_VERSION/bin/javac"
ls -ld /usr/bin/java*
ls -ld /etc/alternatives/java*
$JAVA_JDK_PATH
denotes the path of the downloaded zip-file and $JAVA_JDK_VERSION
the jdk-version to download.
Note: I assume the installation works, since I can typically build other maven projects.
How to I install the jdk in order to get the tools.jar file?
Upvotes: 1
Views: 464
Reputation: 1326
Apparently, this is not possible any more since JDK9, according to @Hans and this post.
Closed.
Upvotes: 0