Different versions of the referenced plugin produce InvalidCastException

9 views
Skip to first unread message

Ivo Bellin Salarin

unread,
Mar 25, 2015, 5:31:55 AM3/25/15
to jenkin...@googlegroups.com
Hi all,

In the plugin I'm currently writing, I reference promoted-builds(-plugin) v2.20. I'm pretty satisfied with this version of the plugin.

On the test environment I decided to add also parametrized-trigger(-plugin). Which depends on promoted-builds(-plugin) v2.10.

During the execution of my plugin, I get an exception like

Caused by: java.lang.ClassCastException: hudson.plugins.promoted_builds.JobPropertyImpl cannot be cast to hudson.plugins.promoted_builds.JobPropertyImpl

I suppose this is related to the version of the plugin. Is there a way to control the (version of the) class being used? Is this due to a change in the interface of the called class? (Comparing the two tags, I see that the signature of some methods in the JobPropertyImpl class has changed -- the synchronized keyword has been added)

Thanks in advance,
Ivo

Jesse Glick

unread,
Mar 25, 2015, 12:09:27 PM3/25/15
to Jenkins Dev
On Wed, Mar 25, 2015 at 5:31 AM, Ivo Bellin Salarin
<ivo.bell...@gmail.com> wrote:
> I suppose this is related to the version of the plugin.

Perhaps.

> Is there a way to control the (version of the) class being used? Is this due to a change in
> the interface of the called class?

No, you can get such a CCE even if the bytecode is identical.

I suspect that you are either not declaring your dependency on
promoted-builds and/or parameterized-trigger correctly, or there is
some subtle bug in the way maven-hpi-plugin sets up the test
environment. Normally Maven’s dependency resolution should force one
or the other version to be added to the test classpath (the “closer”,
2.20 in this case) and that is that.

Ivo Bellin Salarin

unread,
Mar 25, 2015, 12:38:41 PM3/25/15
to Jenkins Dev

I must admit that the parametrized trigger is not a dependency of my plugin. I've copied it in the plugins folder of my dev environment because it is present in our production environment.

Fearing a similar crash in the production environment, I preferred ask the question to confirmed Java/Jenkins devs.


--
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/CANfRfr30R6KFx78HMg64_gba7WMkDdQfUimHAND5n9igoF6gug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Mar 25, 2015, 12:47:17 PM3/25/15
to Jenkins Dev
On Wed, Mar 25, 2015 at 12:38 PM, Ivo Bellin Salarin
<ivo.bell...@gmail.com> wrote:
> I must admit that the parametrized trigger is not a dependency of my plugin.
> I've copied it in the plugins folder of my dev environment because it is
> present in our production environment.

If you feel there is some possible or actual relationship to the code
your plugin is running, add it as a <scope>test</scope> dependency.
Then it will be loaded during functional tests as well as mvn hpi:run.

Ivo Bellin Salarin

unread,
Mar 25, 2015, 12:54:10 PM3/25/15
to Jenkins Dev

Thanks so much.


--
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.
Reply all
Reply to author
Forward
0 new messages