Any plan to move from guice 6 to guice 7?

51 views
Skip to first unread message

Fritz Elfert

unread,
May 30, 2025, 10:36:31 AMMay 30
to jenkin...@googlegroups.com
Hi guys,

As the maintainer of the jclouds plugin, I am stuck with jclouds 2.5.0, because
they moved to guice 7 since jcloud 2.6.0. While I had decent success with shading in the past,
I got a lot of weird failures when attempting to shade the relevant stuff from jcloud
so I gave up on that.

Therfore my question:
Is there a roadmap or some estimate as to when jenkins will switch to guice 7?

Thanks
-Fritz
OpenPGP_signature.asc

Basil Crow

unread,
May 30, 2025, 1:55:29 PMMay 30
to jenkin...@googlegroups.com
Hi Fritz, although jclouds claims to require Guice 7, in practice it
works with Guice 6, which supports both javax and jakarta style
imports. In fact, in JCLOUDS-1629 I had suggested that jclouds upgrade
only to Guice 6, but it seems that they had some difficulty getting
their tests to pass with Guice 6 and went straight for Guice 7, thus
creating this problem.

Artifact Manager on S3 also uses jclouds and thus has the same
problem. I worked around it there by turning off the Enforcer warnings
in https://github.com/jenkinsci/artifact-manager-s3-plugin/blob/e7c0bffccd209e31feff8a5ffde791c5758d09f3/pom.xml#L303-L332
and https://github.com/jenkinsci/plugin-compat-tester/blob/347dabf6092a29ce17df87c9c8b7631b0bf7c92f/src/main/java/org/jenkins/tools/test/hook/ArtifactManagerS3Hook.java.
The second of these links contains a comment explaining why this
works. You could possibly adopt the same workaround in your plugin.
James had an idea for how to clean up this workaround even further,
but I don't remember the details now.

Of course, in the long term Jenkins core should upgrade to Guice 7, as
you point out. The problem with doing this at the moment is that it
would break the (very much not recommended) Jenkins Maven plugin,
which embeds Maven inside of Jenkins using the old javax (not jakarta)
style imports and uses Guice internally. I filed MNG-8027 upstream to
track this Maven issue, but the Maven developers have not yet
prioritized it. So for us to upgrade to Guice 7 in the long term, we
would need to either fix MNG-8027, officially drop support for the
Jenkins Maven plugin (which is still being used by some people), or
find some other solution to keep the Jenkins Maven plugin working with
Guice 7.

Jesse Glick

unread,
May 30, 2025, 2:27:05 PMMay 30
to jenkin...@googlegroups.com
On Fri, May 30, 2025 at 1:55 PM Basil Crow <m...@basilcrow.com> wrote:
in the long term Jenkins core should upgrade to Guice 7

Better still (IMHO) would be to remove the Guice dep from core, letting it just be loaded as a regular library wrapper plugin for the handful of plugins needing it (for example via jclouds or Maven), since the way it is used contributes nothing but bugs and complexity. Not easy to do, since a small number of plugins do seem to rely on objects registered using `@Inject` rather than `@Extension`, or use `Jenkins.getInjector()`.

Basil Crow

unread,
May 30, 2025, 4:15:43 PMMay 30
to jenkin...@googlegroups.com
On Fri, May 30, 2025 at 11:27 AM 'Jesse Glick' via Jenkins Developers
<jenkin...@googlegroups.com> wrote:
> Better still (IMHO) would be to remove the Guice dep from core

This problem is orthogonal to the one being discussed in this thread,
I think. Even if, by some great effort, someone were to extract Guice
from core into a Jenkins library plugin—with Maven, Artifact Manager
on S3, JClouds, and the like consuming it via plugin-to-plugin
dependency—I think we would still be unable to upgrade the Guice
library plugin from 6 to 7 unless we were to

> fix MNG-8027, officially drop support for the Jenkins Maven plugin (which is still being used by some people), or find some other solution to keep the Jenkins Maven plugin working with Guice 7.

The fundamental problem is that Guice 7 removes an old capability
(javax package support), necessitating all consumers to have migrated
from the old capability to the new—while Maven has not migrated, and
has no plans to in the near future. Guice 6 supports both the old and
new capabilities.

Jesse Glick

unread,
Jun 16, 2025, 5:39:37 PMJun 16
to jenkin...@googlegroups.com
On Fri, May 30, 2025 at 4:15 PM Basil Crow <m...@basilcrow.com> wrote:
Even if […] someone were to extract Guice from core into a Jenkins library plugin […] 
I think we would still be unable to upgrade the Guice library plugin from 6 to 7 unless we were to

> fix MNG-8027, officially drop support for the Jenkins Maven plugin (which is still being used by some people), or find some other solution to keep the Jenkins Maven plugin working with Guice 7.

My expectation in that scenario is that we would have a Guice 6 library wrapper plugin plus a Guice 7 plugin, and consumers would pick which one they wanted to depend on, with `maven-plugin` staying on 6 for now. Part of removing it from core would mean avoiding any case where Guice types are exposed from Jenkins APIs and thus need to be shared amongst plugins, so it would be safe to have both versions loaded at once (unless Guice does bad things with `Thread.contextClassLoader`).

Note https://lists.apache.org/list.html?d...@jclouds.apache.org (I would like to remove both jclouds and Guice from `artifact-manager-s3` anyway).
Reply all
Reply to author
Forward
0 new messages