Build class does not invoke get invoked

已查看 36 次
跳至第一个未读帖子

Nikhil Bhoski

未读,
2017年8月7日 01:08:182017/8/7
收件人 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

未读,
2017年8月7日 07:47:442017/8/7
收件人 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

未读,
2017年8月8日 02:23:532017/8/8
收件人 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

未读,
2017年8月8日 08:43:352017/8/8
收件人 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.

回复全部
回复作者
转发
0 个新帖子