Not so simple... For example you may need it to be Item if you are working with literately other multi branch project types.
On Saturday, 17 May 2014, Ikedam <[email protected]> wrote: > Hello plugin developers. > > Abstract: > you should not use @AncestorInPath AbstractItem, > but should use @AncestorInPath AbstractProject > in Descriptor.doXXXX in builders and publishers. > > Details: > We usually use StaplerRequest.findAncestorObject or @AncestorInPath > to retrieve the project instance in Descriptor.doXXXX. > You should use not AbstractItem or Item, but AbstractProject or Job for > its type, > or you would retrieve an unexpected object when used with Cloudbees > Templates plugin. > > http://www.cloudbees.com/jenkins-enterprise-by-cloudbees-features-templates-plugin.cb > > Good code: > public FormValidation doCheckXXX( > @AncestorInPath AbstractItem project, @QueryParameter String > value) { > > Bad code: > public FormValidation doCheckXXX( > @AncestorInPath AbstractProject project, @QueryParameter String > value) { > > Cloudbees Templates plugin injects an AbstractItem object into the stapler > path. > Please see following pages for more details: > https://issues.jenkins-ci.org/browse/JENKINS-22856 > https://issues.jenkins-ci.org/browse/JENKINS-22828 > https://github.com/jenkinsci/copyartifact-plugin/pull/36 > > I know copyartifact plugin and parameterized trigger plugin are > affected by this problem (They will be fixed in the next releases). > As they are popular plugins, I worry that there can be other affected > plugins. > Please have a look on your maintaining plugins. > > Thanks. > ikedam > > -- > 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 > [email protected]<javascript:_e(%7B%7D,'cvml','jenkinsci-dev%[email protected]');> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
