I'm trying to write my first plugin, so apologies for the probably very
obvious questions.
I'm trying to extend FreeStyleProject so that I can override the
'getIconColor' method with some custom functionality (currently just sets it
to 'Not built' for testing but will be doing more later). My current code is
as follows:
package GitBranchFailureNotifier.GitBranchFailureNotifier;
import hudson.Extension;
import hudson.model.BallColor;
import hudson.model.FreeStyleProject;
import hudson.model.ItemGroup;
import hudson.model.TopLevelItem;
import hudson.model.TopLevelItemDescriptor;
public class GitBranchFailureNotifierFreeStyleProject extends
FreeStyleProject {
public GitBranchFailureNotifierFreeStyleProject(ItemGroup parent,
String name) {
super(parent, name);
}
@Override
public BallColor getIconColor() {
return BallColor.NOTBUILT;
}
@Extension
public static final class CustomJobDescriptor extends
TopLevelItemDescriptor
{
@Override
public String getDisplayName() {
return "Git Branch Failure Notifier";
}
@Override
public TopLevelItem newInstance(ItemGroup arg0, String arg1)
{
return new
GitBranchFailureNotifierFreeStyleProject(arg0, arg1);
}
}
}
What I was expecting to happen was for this to show up as a new build type
option alongside the existing set of builds, but clearly I'm doing something
wrong.
Also if there is a better way to override a method (ideally I'd like to do
this for all jobs on our server) please let me know.
Thanks.
--
View this message in context:
http://jenkins-ci.361315.n4.nabble.com/Trying-to-extend-FreeStyleProject-to-override-a-method-tp4788542.html
Sent from the Jenkins dev mailing list archive at Nabble.com.
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/1452163972569-4788542.post%40n4.nabble.com.
For more options, visit https://groups.google.com/d/optout.