archetypes
archetypes copied to clipboard
empty-plugin mode fails with JDK11
Jenkins and plugins versions report
Environment
Paste the output here
What Operating System are you using (both controller, and any agents involved in the problem)?
Windows 10 with Git Bash
Reproduction steps
- Have JDK11 early in PATH as the default
- Run
mvn archetype:generate -Dfilter=io.jenkins.archetypes: - Select
1. empty-plugin - Select a name etc. (in my case
Nfor defaults and picked all the group names etc.)
Expected Results
Successful generation (as it does happen when I export JAVA_HOME="C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot")
Actual Results
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project standalone-pom: could not access constructor: private java.io.File(java.lang.String,java.io.File) with arguments: [Jenkinsfile, C:\continuous-integration\jsl-types] reason: java.lang.IllegalAccessException: class org.codehaus.groovy.reflection.CachedConstructor cannot access a member of class java.io.File (in module java.base) with modifiers "private" -> [Help 1]
Anything else?
Originally PATH pointed to JDK11, even though MVN thought differently - that it has JDK17:
:; mvn -version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: C:\progra~1\Apache\maven
Java version: 17.0.3, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
:; java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)
Exporting JDK17 JAVA_HOME and PATH explicitly did work around the issue:
:; export JAVA_HOME="C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot"
:; export PATH="$JAVA_HOME\bin:$PATH"
Still, as JDK11 is supposed to be a supported baseline for Jenkins, I think this is an issue to address (or document at least).
https://github.com/jenkinsci/archetypes/blob/7efc741c5857c3feba94eaa51e7245baf4c2364f/common-files/archetype-post-generate.groovy#L18-L23
Looks like it would only affect -DhostOnJenkinsGitHub=false?