Build class does not invoke get invoked

36 views
Skip to first unread message

Nikhil Bhoski

unread,
Aug 7, 2017, 1:08:18 AM8/7/17
to Jenkins Developers
Hi ,

I have created new project type . which invokes the appropriate build class to run the build . however i am receiving below error and the build wont get invoked . could someone pls help ?.

java.lang.Error: java.lang.NoSuchMethodException: matlabjenkins.matlabjnk.MatlabItemBuild.<init>(matlabjenkins.matlabjnk.MatlabItem)
        at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:188)
        at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019)
        at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1209)
        at hudson.model.AbstractProject.createExecutable(AbstractProject.java:145)
        at hudson.model.Executor$1.call(Executor.java:362)
        at hudson.model.Executor$1.call(Executor.java:344)
        at hudson.model.Queue._withLock(Queue.java:1404)
        at hudson.model.Queue.withLock(Queue.java:1269)
        at hudson.model.Executor.run(Executor.java:344)
Caused by: java.lang.NoSuchMethodException: matlabjenkins.matlabjnk.MatlabItemBuild.<init>(matlabjenkins.matlabjnk.MatlabItem)
        at java.lang.Class.getConstructor0(Class.java:3082)
        at java.lang.Class.getConstructor(Class.java:1825)
        at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:177)


I am using super.run in build class of mine and all the constructors in Build<?,?> classes are defined in my build file . <init> method may be due to no default constructor in build class . how can i resolve this and get this build invoked . 

Oleg Nenashev

unread,
Aug 7, 2017, 7:47:44 AM8/7/17
to Jenkins Developers
You will unlikely get help here without sharing a link to your code.
My guess is that you use the default BuildMixIn type without providing a constructor required for it

понедельник, 7 августа 2017 г., 7:08:18 UTC+2 пользователь Nikhil Bhoski написал:

Nikhil Bhoski

unread,
Aug 8, 2017, 2:23:53 AM8/8/17
to Jenkins Developers
Thanks Oleg , could not share my code due to organizational policies however . My moto is to create one top level Item (new project type) which is similar to freestyle project & whenever a job is created using this project it should get invoked . i have referred to  jenkins freestyle project & freestly build class to design my own project type. i have used the exact  same methods and constructors in my project & build file . my project class is like as below 

public class MatlabItemp extends Project<MatlabItemp, MatlabItemBuild> implements TopLevelItem {


public MatlabItemp(ItemGroup parent, String name) {
super(parent, name);

}





@Override
public TopLevelItemDescriptor getDescriptor() {

return (TopLevelItemDescriptor)Jenkins.getInstance().getDescriptorOrDie(getClass());
}

@Override
protected Class<MatlabItemBuild> getBuildClass() {

return MatlabItemBuild.class;
}

/----------------------------------------------------------------------------------End------------------------------------------------------------------------------------------------------------------------------/

and my build class is like below 

public class MatlabItemBuild extends Build<MatlabItemp, MatlabItemBuild> {

protected MatlabItemBuild(MatlabItemp project) throws IOException {
super(project);
}




public MatlabItemBuild(MatlabItemp job, Calendar timestamp) {
super(job, timestamp);

}




public MatlabItemBuild(MatlabItemp project, File buildDir) throws IOException {
super(project, buildDir);
}



@Override
public void run() {


super.run();


/-------------------------------------------------------------------------------------------------------------------------------------------End ------------------------------------------------------------------------------------------------------------------------

Baptiste Mathus

unread,
Aug 8, 2017, 8:43:35 AM8/8/17
to Jenkins Developers
I think you should still prefer trying to extract the gist of your code and create a PR or something reviewable online to maximize your chances to get feedback, ideally on GitHub where it's easy to do. Reviewing code in emails is a quite a bit cumbersome.

After a quick glance at the code, aren't you missing the @Extension annotation?

--
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/1d12c8bc-5686-4073-bb5c-30be0417606b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages