1

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>  

The Problem

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.


Installation of the jdk

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?

agentsmith
  • 1,226
  • 1
  • 14
  • 27
  • Not that this is much of a solution, but the `tools.jar` has been removed from the JDK with Java9: https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-D867DCCC-CEB5-4AFA-9D11-9C62B7A3FAB1 – Hans Aug 07 '20 at 08:25
  • @Hans: I just read throgh this [post](https://stackoverflow.com/questions/53707666/how-to-get-tools-jar-for-openjdk-11-on-windows) and it says the same. I was hoping for better news that this. – agentsmith Aug 07 '20 at 08:29

1 Answers1

0

Apparently, this is not possible any more since JDK9, according to @Hans and this post.

Closed.

agentsmith
  • 1,226
  • 1
  • 14
  • 27