Java 17 support added to build toolchain

912 views
Skip to first unread message

Basil Crow

unread,
Apr 5, 2022, 6:01:32 PM4/5/22
to jenkin...@googlegroups.com
Release 4.40 of the plugin parent POM features build toolchain support for Java 17 when running on Jenkins 2.341 or later.

Please begin testing your plugins on Java 17 by taking the following actions:
  1. Upgrade to release 4.40 or later of the plugin parent POM.
  2. Delete <java.level>8</java.level> from your plugin POM.
  3. Update your Jenkinsfile to include a test run on Jenkins 2.341 or later and Java 17.

The java.level property has been deprecated and should be removed from your plugin's POM. In the future this warning will be changed to an error and will break the build.

The addition of @{jenkins.addOpens} and @{jenkins.insaneHook} to argLine exposes a bug in IntelliJ IDEA. A patch has been merged in JetBrains/intellij-community#1976. Pending the release of this patch, IntelliJ IDEA users should work around the problem as follows:

  1. Go to Settings > Build, Execution, Deployment > Build Tools > Maven > Running Tests.
  2. Under "Pass to JUnit process [the] following maven-surefire-plugin and maven-failsafe-plugin settings", uncheck argLine.

Failure to work around the problem as described above will result in a could not open '{jenkins.addOpens}' failure when running tests in IntelliJ IDEA.

Also note that the workaround does not suffice for Java 17 support. For Java 17 support in IntelliJ IDEA, we must wait for the release of JetBrains/intellij-community#1976.

Mark Waite

unread,
Apr 6, 2022, 12:51:04 AM4/6/22
to Jenkins Developers
On Tuesday, April 5, 2022 at 4:01:32 PM UTC-6 Basil wrote:
Release 4.40 of the plugin parent POM features build toolchain support for Java 17 when running on Jenkins 2.341 or later.

Please begin testing your plugins on Java 17 by taking the following actions:
  1. Upgrade to release 4.40 or later of the plugin parent POM.
  2. Delete <java.level>8</java.level> from your plugin POM.
  3. Update your Jenkinsfile to include a test run on Jenkins 2.341 or later and Java 17.

Thanks for doing that.  I've successfully updated 6 plugins to test with Java 17.  No issues reported in any of the 6 plugins.

I need further guidance on one plugin.  It fails with a runtime exception in the test.  The exception should be visible in https://ci.jenkins.io/job/Plugins/job/git-plugin/view/change-requests/job/PR-1249/

It looks like this on my development environment:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.462 s <<< FAILURE! - in hudson.plugins.git.CliGitSCMTriggerLocalPollTest
[ERROR] hudson.plugins.git.CliGitSCMTriggerLocalPollTest.testNamespaces_with_refsHeadsMaster  Time elapsed: 3.367 s  <<< ERROR!
java.io.IOException: java.lang.RuntimeException: Failed to serialize hudson.model.AbstractProject#scm for class hudson.model.FreeStyleProject
        at hudson.XmlFile.write(XmlFile.java:220)
        at hudson.model.AbstractItem.save(AbstractItem.java:617)
        at hudson.model.Job.save(Job.java:193)
        at hudson.model.AbstractProject.save(AbstractProject.java:289)
        at hudson.model.AbstractProject.setScm(AbstractProject.java:1506)
        at hudson.plugins.git.AbstractGitProject.setupProject(AbstractGitProject.java:193)
        at hudson.plugins.git.SCMTriggerTest.check(SCMTriggerTest.java:244)
        at hudson.plugins.git.SCMTriggerTest.testNamespaces_with_refsHeadsMaster(SCMTriggerTest.java:63)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
        at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:606)
        at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
        at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Failed to serialize hudson.model.AbstractProject#scm for class hudson.model.FreeStyleProject
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
        at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:241)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:226)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44)
        at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:83)
        at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:1266)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:1255)
        at com.thoughtworks.xstream.XStream.toXML(XStream.java:1228)
        at hudson.XmlFile.write(XmlFile.java:213)
        ... 22 more
Caused by: java.lang.RuntimeException: Failed to serialize hudson.plugins.git.GitSCM#userRemoteConfigs for class hudson.plugins.git.GitSCM
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
        at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:241)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:226)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
 
Mark Waite

Alexander Brandes

unread,
Apr 6, 2022, 4:08:24 AM4/6/22
to Jenkins Developers
Thanks for your work, basil (again!)

I've updated a bunch of plugins without issues.

Based on my prior experience when building with Java 17,  the spotbugs-maven-plugin throws a few warnings regarding JEP 411 (Java, not Jenkins). These warnings should be safe to be ignored, because a PR is work in progress to take care of that.

~ Alex

Jesse Glick

unread,
Apr 6, 2022, 8:56:25 AM4/6/22
to jenkin...@googlegroups.com
Thanks Basil! Mark I added an analysis in your PR.

Basil Crow

unread,
Apr 6, 2022, 10:43:04 AM4/6/22
to jenkin...@googlegroups.com
On Tue, Apr 5, 2022 at 9:51 PM Mark Waite <mark.ea...@gmail.com> wrote:
> I need further guidance on one plugin.

I took a look at your code and see that you are overriding the <argLine> from the plugin parent POM in your plugin POM. This override is not extending the original value but replacing it, just as overriding a method in a subclass without calling super() in Java code would replace the original method rather than extend it. As of 4.39 this meant that your plugin was blanking out the -Xms, -Xmx, -XX:HeapDumpOnOutOfMemoryError, -XX:TieredCompilation, and -XX:TieredStopAtLevel settings from the plugin parent POM – incorrect, but harmless. As of 4.40, this means your plugin is blanking out the @{jenkins.addOpens} and @{jenkins.insaneHook} settings from the plugin parent POM – incorrect, and harmful when running on Java 17.

I suggest either removing your override of <argLine> (recommended, if possible) or changing it so that it extends the setting from the plugin parent POM rather than replacing it. Since your plugin was in error before the release of plugin parent POM 4.40, I am not going to update the plugin parent POM 4.40 release notes.

The <argLine> interface exposed by the plugin parent POM is not ideal, and this mistake is particularly easy to make. The interface could be cleaned up by introducing a property with default JVM settings that you could override, but since this is a pre-existing issue that I am making neither better nor worse with recent changes, I have no plans to work on it.

Jiri Vanek

unread,
Apr 16, 2022, 5:27:00 AM4/16/22
to jenkin...@googlegroups.com, Basil Crow
Hello!

Maybe the parent should now contains:
<requireMavenVersion>
<version>[3.8.1,)</version>
...

As that is ldest maven it works with?

Thanx a lot!

J.
On 4/6/22 00:00, Basil Crow wrote:
> Release 4.40 of the plugin parent POM <https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-4.40> features build toolchain support for Java 17 when running on Jenkins 2.341 or later.
>
> Please begin testing your plugins on Java 17 by taking the following actions:
>
> 1. Upgrade to release 4.40 or later of the plugin parent POM.
> 2. Delete <java.level>8</java.level> from your plugin POM.
> 3. Update your Jenkinsfile to include a test run on Jenkins 2.341 or later and Java 17.
>
> See jenkinsci/email-ext-plugin#357 <https://github.com/jenkinsci/email-ext-plugin/pull/357> and jenkinsci/timestamper-plugin#167 <https://github.com/jenkinsci/timestamper-plugin/pull/167> for examples.
>
> The |java.level| property has been deprecated and should be removed from your plugin's POM. In the future this warning will be changed to an error and will break the build.
>
>
> The addition of |@{jenkins.addOpens}| and |@{jenkins.insaneHook}| to |argLine| exposes a bug in IntelliJ IDEA. A patch has been merged in JetBrains/intellij-community#1976 <https://github.com/JetBrains/intellij-community/pull/1976>. Pending
> the release of this patch, IntelliJ IDEA users should work around the problem as follows:
>
> 1. Go to *Settings* > *Build, Execution, Deployment* > *Build Tools* > *Maven* > *Running Tests*.
> 2. Under "Pass to JUnit process [the] following |maven-surefire-plugin| and |maven-failsafe-plugin| settings", uncheck |argLine|.
>
> Failure to work around the problem as described above will result in a |could not open '{jenkins.addOpens}'| failure when running tests in IntelliJ IDEA.
>
> Also note that the workaround does not suffice for Java 17 support. For Java 17 support in IntelliJ IDEA, we must wait for the release of JetBrains/intellij-community#1976 <https://github.com/JetBrains/intellij-community/pull/1976>.
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com <mailto:jenkinsci-de...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAFwNDjqnFh_9e792L%3DyaACrgh1EqecbBWEi7zZV6brw8sbsy1Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/CAFwNDjqnFh_9e792L%3DyaACrgh1EqecbBWEi7zZV6brw8sbsy1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
Jiri Vanek Mgr.
Principal QA Software Engineer
Red Hat Inc.
+420 775 39 01 09

Reply all
Reply to author
Forward
0 new messages