I try to get a minimal empty jenkins plugin to compile and show in a jetty jenkins.
I created a new Java Project and made it into a maven project.
Right Click -> Configure -> Into Maven
.
My problem stems from the Parent.
Group Id: org.jenkins-ci.plugins
Artifact Id: plugin
Version: 3.9
When I execute the Goal RunAs -> Maven -> Install
I get an error.
The error string contains:
maven-enforcer-plugin:3.0.0-M1:enforce failed: Unknown JDK version given. Should be something like "1.7"
I Installed multiple Java Versions in the machine so I should have some to choose from. I tried to set a deifferent JRE dependency in the Project Propererties with no effect.
A bit further up there is a relevant output:
[INFO] --- maven-enforcer-plugin:3.0.0-M1:display-info (display-info) @ ManualTestingMapper ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.8.0_162 normalized as: 1.8.0-162
[INFO] OS Info: Arch: amd64 Family: windows Name: windows 7 Version: 6.1
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (display-info) @ ManualTestingMapper ---
My Windows environment has JAVA_HOME=c:\Program Files (x86)\Java\jre8u152
and the PATH also points in that general direction.
How does one fix this in eclipse? I would need to change the JDK version on a per project level. I can not find anything useful using google - those were all dead ends fir me.
EDIT: I should mention that changing the Project Facets to Java 1.7 gives the enforcer output:
[INFO] --- maven-enforcer-plugin:3.0.0-M1:display-info (display-info) @ ManualTestingMapper ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.7.0_80 normalized as: 1.7.0-80
[INFO] OS Info: Arch: amd64 Family: windows Name: windows 7 Version: 6.1
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (display-info) @ ManualTestingMapper ---
The error about needing JDK 1.7 is still the same though.
EDIT: Here is my POM, I updated the IDs to something neutral.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SOGrouID</groupId>
<artifactId>SOArtifactID</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SOName</name>
<description>SOName is a Stackoverflow Example.</description>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.9</version>
</parent>
</project>
The parent POM contains
<requireJavaVersion>
<version>[1.8.0,)</version>
</requireJavaVersion>
which raises more questions than it answers. The whole parent POM can be inspected on github.
EDIT: Running the maven goal Install -X gives the exception type:
java.lang.IllegalArgumentException: Unknown JDK version given. Should be something like "1.7"
I guess "1.7" could be meant as a format example. If that is so then the plugin may be presented with an incomprehensible format string of sorts?
Thanks to @Kai who pointed me towards the parent POM. There are a bunch of properties that are marked with
you-must-override
. One of them isThe
IllegalArgumentException
comes from the string that was given.Overriding that property in the pom removes the issue.