Upgrade guava to at least 18.0

24 views
Skip to first unread message

tamal

unread,
Feb 21, 2017, 9:41:25 PM2/21/17
to Jenkins Developers
Hi,
We are writing some custom Jenkins plugin that uses auto generated gRPC java client. The issue is Jenkins by default bundles Guava 15.0. But gRPC client needs 18.0, otherwise we are getting Method Not Found exceptions. So, we have modified Jenkins to use Guava 18.0. But the issue is between 15.0 and 18.0, Guava renamed method Iterators.skip() to Iterators.advance(). You can see our commit here: 


My question is will it be possible to upgrade Jenkins to use at least Guava 18.0 ?

Thanks.

tamal

unread,
Feb 21, 2017, 9:42:25 PM2/21/17
to Jenkins Developers
I meant to say Jenkins uses Guava 11.x.

Oliver Gondža

unread,
Feb 22, 2017, 2:34:08 AM2/22/17
to jenkin...@googlegroups.com
I have struggled with this for a long time and (except for a distaste to
google developed libraries i have developed) it was a waste of time.
Changing the guava version in core is a challenge as there likely are
many plugins that depend on that particular version and updating it
would break binary compatibility for those plugins. What worked for me
here was instructing maven-hpi-plugin to use pluginFirstClassLoader so
your plugin will prefer the version of guava it bundles rather than the
one core happens to use. Both shading and class masking had subtle problems.

HTH
--
oliver

Stephen Connolly

unread,
Feb 22, 2017, 8:31:41 AM2/22/17
to jenkin...@googlegroups.com
Friends don't let friends use guava



--
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-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1ae5e6a7-f031-5d72-36ed-8249ea32f68e%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

tamal

unread,
Feb 22, 2017, 8:36:14 PM2/22/17
to Jenkins Developers
Oliver,
"What worked for me 
here was instructing maven-hpi-plugin to use pluginFirstClassLoader so 
your plugin will prefer the version of guava it bundles rather than the 
one core happens to use. Both shading and class masking had subtle problems. "

Do you have any example or docs that you can point me to? Thank you,

-Tamal

Oliver Gondža

unread,
Feb 23, 2017, 2:51:23 AM2/23/17
to jenkin...@googlegroups.com
On 2017-02-23 02:36, tamal wrote:
> Oliver,
> "What worked for me
> here was instructing maven-hpi-plugin to use pluginFirstClassLoader so
> your plugin will prefer the version of guava it bundles rather than the
> one core happens to use. Both shading and class masking had subtle
> problems. "
>
> Do you have any example or docs that you can point me to? Thank you,

https://jenkinsci.github.io/maven-hpi-plugin/plugin-info.html
https://jenkinsci.github.io/maven-hpi-plugin/hpl-mojo.html#pluginFirstClassLoader
https://github.com/jenkinsci/openstack-cloud-plugin/blob/de02466d84f00eac7260345cc6784f354aabf76a/pom.xml#L117-L123

--
oliver

tamal

unread,
Feb 23, 2017, 11:23:03 AM2/23/17
to Jenkins Developers
Thanks Oliver.

Andrew Bayer

unread,
Feb 23, 2017, 3:40:39 PM2/23/17
to jenkin...@googlegroups.com
fwiw, that seems to only work for certain Guava version differences - over in the jclouds plugin, I eventually ran into problems going to anything past Guava 13, I think, and ended up needing to shade Guava.

A.

--
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-dev+unsubscribe@googlegroups.com.

Oliver Gondža

unread,
Feb 23, 2017, 3:53:20 PM2/23/17
to jenkin...@googlegroups.com
On 2017-02-23 21:40, Andrew Bayer wrote:
> fwiw, that seems to only work for certain Guava version differences -
> over in the jclouds plugin, I eventually ran into problems going to
> anything past Guava 13, I think, and ended up needing to shade Guava.

The openstack plugin is a fork of jclouds so I ended up fighting the
same beast. IIUC, shading (or rather class relocation) help if your
plugin code needs newer guava, which is rarely the case. It is usually
some dependency that needs that but it is not referring to your shaded
classes of course so it gets the original ones.

--
oliver

Stephen Connolly

unread,
Feb 23, 2017, 4:17:55 PM2/23/17
to jenkin...@googlegroups.com
Then you need to shade that dependency...

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/f3a35d24-186a-5b42-934a-58983d6fca2f%40gmail.com.

For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

Andrew Bayer

unread,
Feb 23, 2017, 7:23:48 PM2/23/17
to jenkin...@googlegroups.com
Yyyyup. See https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/master/pipeline-model-json-shaded/pom.xml in Declarative for an example of that. And for that matter, the jclouds/OpenStack plugins are the same thing - they need to create a shaded uberjar of jclouds and Guava, with Guava relocated.

A.

On Thu, Feb 23, 2017 at 1:17 PM, Stephen Connolly <stephen.al...@gmail.com> wrote:
Then you need to shade that dependency...
On Thu 23 Feb 2017 at 20:53, Oliver Gondža <ogo...@gmail.com> wrote:
On 2017-02-23 21:40, Andrew Bayer wrote:
> fwiw, that seems to only work for certain Guava version differences -
> over in the jclouds plugin, I eventually ran into problems going to
> anything past Guava 13, I think, and ended up needing to shade Guava.

The openstack plugin is a fork of jclouds so I ended up fighting the
same beast. IIUC, shading (or rather class relocation) help if your
plugin code needs newer guava, which is rarely the case. It is usually
some dependency that needs that but it is not referring to your shaded
classes of course so it gets the original ones.

--
oliver

--
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-dev+unsubscribe@googlegroups.com.
--
Sent from my phone

--
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-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMzuGtrxmAK5YVPfm3R9-31hqepZG2vxVf5R4%2BnnXmjAyg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages