Two Extension Points in one plug-in

28 views
Skip to first unread message

Jason Goff

unread,
Jul 19, 2019, 8:06:34 AM7/19/19
to Jenkins Developers
Hi,

I'm new to plug-in development, and having studied a couple of basic examples, plus the archetypes, I'm in the process of creating a plug-in for our specific use-case.

My problem is that I want to be able to have different build steps in the plug-in, for example, a ReleaseFile step and a PatchFile step.  I have created 2 Builder classes and 2 associated Callables  My Builders look like the below.

When I install the plugin into Jenkins, only the HeathviewPatchBuilder is available.  The HeathviewReleaseBuilder creates an error in the log:

class com.etas.jenkins.plugins.HeathviewPlugin.HeathviewReleaseBuilder is missing its descriptor


Any and all suggestions as to what I'm doing wrong gratefully received!

Thanks in advance!

Jase

public class HeathviewReleaseBuilder extends Builder {
@DataBoundConstructor
public HeathviewReleaseBuilder(boolean beginOutput, String patchOrder, String buildName) {
...
}

    @Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
    ...
}


@Override
public HVReleaseDescriptorImpl getDescriptor() {
return (HVReleaseDescriptorImpl)super.getDescriptor();
}


@Extension // This indicates to Jenkins that this is an implementation of an extension point.
public static final class HVReleaseDescriptorImpl extends BuildStepDescriptor<Builder> {

public HVReleaseDescriptorImpl() {
load();
}

public boolean isApplicable(Class<? extends AbstractProject> aClass) {
return true;
}

public String getDisplayName() {
return "Heathview: Create Release File header or footer XML section.";
}

@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
save();
return super.configure(req,formData);
}
}
}



public class HeathviewPatchBuilder extends Builder {
@DataBoundConstructor
public HeathviewPatchBuilder(boolean beginOutput, String buildName) {
...
}

    @Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
    ...
}


@Override
public HVPatchDescriptorImpl getDescriptor() {
return (HVPatchDescriptorImpl)super.getDescriptor();
}


@Extension // This indicates to Jenkins that this is an implementation of an extension point.
public static final class HVPatchDescriptorImpl extends BuildStepDescriptor<Builder> {

public HVPatchDescriptorImpl() {
load();
}

public boolean isApplicable(Class<? extends AbstractProject> aClass) {
return true;
}
public String getDisplayName() {
return "Heathview: Create Patch File header or footer XML section.";
}

@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
save()
return super.configure(req,formData);
}
}
}


Jason Goff

unread,
Jul 19, 2019, 8:55:59 AM7/19/19
to Jenkins Developers
Solved it.  My own fault with package collisions.  

Chris Edgington

unread,
Apr 11, 2022, 8:19:18 AM4/11/22
to Jenkins Developers
Hi Jason, I'm also experiencing this issue, and banging my head against the wall. Could you clarify what your fix was?

Thanks!
Chris

Reply all
Reply to author
Forward
0 new messages