JoelJ / Templating

A better template and scaffolding plugin for Jenkins
Apache License 2.0
9 stars 13 forks source link

Not working with Jenkins latest versions #5

Open kvysh opened 10 years ago

kvysh commented 10 years ago

I tried it on Jenkins 1.546 & 1.550, Following exception thrown

Stack trace javax.servlet.ServletException: java.lang.ClassCastException: Cannot cast hudson.util.DescribableList to java.util.Vector at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:778) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858) at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:390) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)

abozzoni commented 10 years ago

I have the same problem with the 1.575

Caused by: java.lang.ClassCastException: Cannot cast hudson.util.DescribableList to java.util.Vector at java.lang.Class.cast(Class.java:3005) at com.attask.jenkins.ReflectionUtils.getField(ReflectionUtils.java:40) at com.attask.jenkins.templates.ImplementationBuildWrapper.refreshAndSave(ImplementationBuildWrapper.java:142) at com.attask.jenkins.templates.ImplementationBuildWrapper.syncFromTemplate(ImplementationBuildWrapper.java:97) at com.attask.jenkins.templates.ImplementationBuildWrapper.sync(ImplementationBuildWrapper.java:64) at com.attask.jenkins.templates.TemplateSyncAction.doSync(TemplateSyncAction.java:27)

abozzoni commented 10 years ago

I change in in the method refreshAndSave(...) of the class ImplementationBuildWrapper Vector triggers = ReflectionUtils.getField(Vector.class, newImplementation, "triggers"); with this one: List triggers = ReflectionUtils.getField(List.class, newImplementation, "triggers"); and seems to work. the only thing I don't understand is why the list of the triggers of the project that use the template is cleared and only the triggers of the template are used.

fdelapena commented 10 years ago

I had the same issue with some plugins when upgrading to 1.565.2 stable from older stable. My old jobs needed to add the class="hudson.util.DescribableList" attribute to the <triggers> tag in every jobs/jobname/config.xml. New jobs are adding this attribute by default.