[no subject]
Hi Team, Need your help! I have been using the jenkins-ci plugins for my custom plugin development. Until now I was able to compile the maven dependencies against java8. All of sudden the dependencies which are getting downloaded are compatible with java11 and not with java8. So facing the below compilation issues. [INFO] 1 error [INFO] - [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 8.767 s [INFO] Finished at: 2023-01-09T06:40:13-06:00 [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project STE: Compilation failure [ERROR] /D:/workspace/Build/src/main/java/com/oracle/siebel/jenkins/BuildStepCreator.java:[6,27] cannot access org.kohsuke.stapler.DataBoundSetter [ERROR] bad class file: C:\Users\kulsriva\.m2\repository\org\kohsuke\stapler\stapler\1756.vec9071748061\stapler-1756.vec9071748061.jar(org/kohsuke/stapler/DataBoundSetter.class) [ERROR] class file has wrong version 55.0, should be 52.0 [ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. [ERROR] Please help on how to use java8 compatible dependencies. -- Thanks & Regards Kul Bhushan Srivastava -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAKJAm15o0pkb0iKUxRr5EJW0OBoLTrB4X-0Q%2BZcDHCMi1cU3Gw%40mail.gmail.com.
Custom Build Step configuration is not persistent. It disappears on server restart or Reloading Configuration from disk.
I have created a custom build step. Added a text area in config.jelly. Whatever I am putting in the text area is getting saved but on restarting the server or reloading it disappears. Please help. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/bb11420a-0d08-441e-b421-91d873ddb046%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to execute single Jenkins job on multiple platforms with different parameters?
Correction : I have created one build job in Jenkins. I want to use that same job to run on multiple nodes but with different value for job parameter for each node. On Wednesday, 23 November 2016 15:50:08 UTC+5:30, Kul Bhushan Srivastava wrote: > > > I have created one build job in Jenkins. I want to use that same job to > run on multiple nodes but with different job parameter. > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5e04c660-0fa6-4cdc-a030-d7e136e29495%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to execute single Jenkins job on multiple platforms with different parameters?
I have created one build job in Jenkins. I want to use that same job to run on multiple nodes but with different job parameter. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/09aa5623-f7ec-40b1-a730-bd2fe8445349%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to change the default value of Global Environment Variable through build job configuration at run time?
Can anybody suggest. How to do it? I tried to do it other way as well. I set a system environment variable through 'Execute Windows Batch' build step. The variable got set successfully. But it is not available in the next step unless I restart the jenkins server. Please help. On Friday, 18 November 2016 23:16:36 UTC+5:30, Kul Bhushan Srivastava wrote: > > How to change the default value of Global Environment Variable through > build job configuration at run time? > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/93ddeea9-fd6f-4e67-8c6a-88947af3cf37%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to change the default value of Global Environment Variable through build job configuration at run time?
How to change the default value of Global Environment Variable through build job configuration at run time? -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1a22e1a7-96ae-4e54-97bc-6ce56763843b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to Add Custom Build Step to behave exactly same as Execute Windows Batch Command.
@since 1.549 */ protected int join(Proc p) throws IOException, InterruptedException { return p.join(); } /** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(@Nonnull FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("jenkins", getFileExtension(), getContents(), false); } public abstract String[] buildCommandLine(FilePath script); protected abstract String getContents(); protected abstract String getFileExtension(); private static final Logger LOGGER = Logger.getLogger(CommandInterpreter.class.getName()); } On Thursday, 17 November 2016 13:54:00 UTC+5:30, Kul Bhushan Srivastava wrote: > > Agree with your point. > > I have change the code accordingly. Compiles properly through Maven. But > now Jenkins at Runtime throwing exception when saving the job > configuration, saying - > > Caused by: java.lang.IllegalArgumentException: Failed to instantiate class > com.oracle.siebel.jenkins.ABC from > {"enableText1":{"text1":"hello"},"enableText2":{"text2":"kul"},"enableText3":{"text3":"bhushan"},"stapler-class":"com.oracle.siebel.jenkins.ABC","$class":"com.oracle.siebel.jenkins.ABC"} > at > org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:674) > at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:476) > at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:472) > at hudson.model.Descriptor.newInstance(Descriptor.java:588) > ... 81 more > Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no > @DataBoundConstructor on any constructor of class > com.oracle.siebel.jenkins.ABC > at > org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:177) > at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:756) > at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:81) > at > org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:672) > ... 84 more > > *New Java File* > > import org.kohsuke.stapler.DataBoundConstructor; > import hudson.Extension; > import hudson.FilePath; > import hudson.Launcher; > import hudson.tasks.Messages; > import hudson.Proc; > import hudson.Util; > import hudson.EnvVars; > import hudson.model.AbstractBuild; > import hudson.model.AbstractDescribableImpl; > import hudson.model.BuildListener; > import hudson.model.Node; > import hudson.model.Result; > import hudson.model.TaskListener; > import hudson.remoting.ChannelClosedException; > import hudson.model.AbstractProject; > import hudson.tasks.BuildStepDescriptor; > import hudson.tasks.Builder; > import hudson.tasks.CommandInterpreter; > import java.io.IOException; > import java.util.Map; > import java.util.logging.Level; > import java.util.logging.Logger; > import javax.annotation.Nonnull; > > public class BuildStepCreator extends Builder{ > > private String text1, text2, text3; > > public String getText1(){ > return text1; > } > public String getText2(){ > return text2; > } > public String getText3(){ > return text3; > } > > @DataBoundConstructor > public BuildStepCreator(OptionalTextBlock1 enableText1, > OptionalTextBlock2 enableText2, OptionalTextBlock3 enableText3) { > this.text1 = (enableText1 != null) ? enableText1.text1 : null; > this.text2 = (enableText2 != null) ? enableText2.text2 : null; > this.text3 = (enableText3 != null) ? enableText3.text3 : null; > } > > public static class OptionalTextBlock1 { > private String text1; > @DataBoundConstructor > public OptionalTextBlock1(String text1) { > this.text1 = text1; > } > } > public static class OptionalTextBlock2 { > private String text2; > @DataBoundConstructor > public OptionalTextBlock2(String text2) { > this.text2 = text2; > } > } > public static class OptionalTextBlock3 { > private String text3; > @DataBoundConstructor > public OptionalTextBlock3(String text3) { > this.text3 = text3; > } > } > } > > abstract class ABC extends BuildStepCreator{ > > public ABC(OptionalTextBlock1 enableText1, OptionalTextBlock2 > enableText2, OptionalTextBlock3 enableText3) { > super(enableText1, enableText2, enableText3);
Re: How to Add Custom Build Step to behave exactly same as Execute Windows Batch Command.
, Launcher launcher, TaskListener listener) throws InterruptedException{ FilePath ws = build.getWorkspace(); if (ws == null) { Node node = build.getBuiltOn(); if (node == null) { throw new NullPointerException("no such build node: " + build.getBuiltOnStr()); } throw new NullPointerException("no workspace from node " + node + " which is computer " + node.toComputer() + " and has channel " + node.getChannel()); } FilePath script=null; int r = -1; try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript())); return false; } try { EnvVars envVars = build.getEnvironment(listener); // on Windows environment variables are converted to all upper case, // but no such conversions are done on Unix, so to make this cross-platform, // convert variables to all upper cases. for(Map.Entry<String,String> e : build.getBuildVariables().entrySet()) envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start()); if(isErrorlevelForUnstableBuild(r)) { build.setResult(Result.FAILURE); r = 0; } } catch (IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_CommandFailed())); } return r==0; } finally { try { if(script!=null) script.delete(); } catch (IOException e) { if (r==-1 && e.getCause() instanceof ChannelClosedException) { // JENKINS-5073 // r==-1 only when the execution of the command resulted in IOException, // and we've already reported that error. A common error there is channel // losing a connection, and in that case we don't want to confuse users // by reporting the 2nd problem. Technically the 1st exception may not be // a channel closed error, but that's rare enough, and JENKINS-5073 is common enough // that this suppressing of the error would be justified LOGGER.log(Level.FINE, "Script deletion failed", e); } else { Util.displayIOException(e,listener); e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } catch (Exception e) { e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } } /** * Reports the exit code from the process. * * This allows subtypes to treat the exit code differently (for example by treating non-zero exit code * as if it's zero, or to set the status to {@link Result#UNSTABLE}). Any non-zero exit code will cause * the build step to fail. Use {@link #isErrorlevelForUnstableBuild(int exitCode)} to redefine the default * behaviour. * * @since 1.549 */ protected int join(Proc p) throws IOException, InterruptedException { return p.join(); } /** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(@Nonnull FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("hudson", getFileExtension(), getContents(), false); } private static final Logger LOGGER = Logger.getLogger(CommandInterpreter.class.getName()); } On Wednesday, 16 November 2016 23:00:36 UTC+5:30, Robert Sandell wrote: > > Abstract classes cannot be instanciated, so you can't annotate the > constructor with DataBoundConstructor since the class can't be directly > instanciated but will need to be subclassed. > > /B > > On Wed, Nov 16, 2016 at 3:59 PM, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > >> Thanks Robert. >> >> I am facing maven compilation issue. Saying @DataBoundConstructor cannot >> be used inside abstract class. >> >> Please suggest. >> >> My Java File: >> >> import org.kohsuke.stapler.DataBoundConstructor; >> import hudson.Extension; >> import hudson.FilePath; >> import hudson.Launcher; >> import hudson.tasks.Messages;
Re: How to Add Custom Build Step to behave exactly same as Execute Windows Batch Command.
Agree with your point. Can you help me with the exact code change. On Wednesday, 16 November 2016 23:00:36 UTC+5:30, Robert Sandell wrote: > > Abstract classes cannot be instanciated, so you can't annotate the > constructor with DataBoundConstructor since the class can't be directly > instanciated but will need to be subclassed. > > /B > > On Wed, Nov 16, 2016 at 3:59 PM, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > >> Thanks Robert. >> >> I am facing maven compilation issue. Saying @DataBoundConstructor cannot >> be used inside abstract class. >> >> Please suggest. >> >> My Java File: >> >> import org.kohsuke.stapler.DataBoundConstructor; >> import hudson.Extension; >> import hudson.FilePath; >> import hudson.Launcher; >> import hudson.tasks.Messages; >> import hudson.Proc; >> import hudson.Util; >> import hudson.EnvVars; >> import hudson.model.AbstractBuild; >> import hudson.model.BuildListener; >> import hudson.model.Node; >> import hudson.model.Result; >> import hudson.model.TaskListener; >> import hudson.remoting.ChannelClosedException; >> import hudson.model.AbstractProject; >> import hudson.tasks.BuildStepDescriptor; >> import hudson.tasks.Builder; >> import hudson.tasks.CommandInterpreter; >> import java.io.IOException; >> import java.util.Map; >> import java.util.logging.Level; >> import java.util.logging.Logger; >> import javax.annotation.Nonnull; >> >> public abstract class BuildStepCreator extends Builder { >> >> private String text1, text2, text3; >> >> public String getText1(){ >> return text1; >> } >> public String getText2(){ >> return text2; >> } >> public String getText3(){ >> return text3; >> } >> >> >> @DataBoundConstructor >> public BuildStepCreator(OptionalTextBlock1 enableText1, >> OptionalTextBlock2 enableText2, OptionalTextBlock3 enableText3) { >> this.text1 = (enableText1 != null) ? enableText1.text1 : null; >> this.text2 = (enableText2 != null) ? enableText2.text2 : null; >> this.text3 = (enableText3 != null) ? enableText3.text3 : null; >> } >> >> public static class OptionalTextBlock1 { >> private String text1; >> @DataBoundConstructor >> public OptionalTextBlock1(String text1) { >> this.text1 = text1; >> } >> } >> public static class OptionalTextBlock2 { >> private String text2; >> @DataBoundConstructor >> public OptionalTextBlock2(String text2) { >> this.text2 = text2; >> } >> } >> public static class OptionalTextBlock3 { >> private String text3; >> @DataBoundConstructor >> public OptionalTextBlock3(String text3) { >> this.text3 = text3; >> } >> } >> >> @Extension >> public static final class DescriptorImpl extends >> BuildStepDescriptor{ >> >> /*public FormValidation doCheckTask(@QueryParameter String value){ >> try{ >> if(value.equalsIgnoreCase(null) || >> value.equalsIgnoreCase("")){ >> return FormValidation.error("Invalid Details."); >> } >> }catch(Exception e){ >> return FormValidation.error("Error validating the form >> details."); >> } >> return FormValidation.ok(); >> } >> >> public FormValidation doCheckGoal(@QueryParameter String value){ >> try{ >> Integer.parseInt(value); >> }catch(Exception e){ >> return FormValidation.error("Please provide integer in >> the Goal."); >> } >> return FormValidation.ok(); >> }*/ >> >> @Override >> public boolean isApplicable(Class >> jobType) { >> // TODO Auto-generated method stub >> return true; >> } >> >> @Override >> public String getDisplayName() { >> // TODO Auto-generated method stub >> return "Job Orchestration"; >> } >> } >> >> /*@Override >> public boolean perform(hudson.model.AbstractBuild bu
Re: How to Add Custom Build Step to behave exactly same as Execute Windows Batch Command.
ception e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript())); return false; } try { EnvVars envVars = build.getEnvironment(listener); // on Windows environment variables are converted to all upper case, // but no such conversions are done on Unix, so to make this cross-platform, // convert variables to all upper cases. for(Map.Entry<String,String> e : build.getBuildVariables().entrySet()) envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start()); if(isErrorlevelForUnstableBuild(r)) { build.setResult(Result.UNSTABLE); r = 0; } } catch (IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_CommandFailed())); } return r==0; } finally { try { if(script!=null) script.delete(); } catch (IOException e) { if (r==-1 && e.getCause() instanceof ChannelClosedException) { // JENKINS-5073 // r==-1 only when the execution of the command resulted in IOException, // and we've already reported that error. A common error there is channel // losing a connection, and in that case we don't want to confuse users // by reporting the 2nd problem. Technically the 1st exception may not be // a channel closed error, but that's rare enough, and JENKINS-5073 is common enough // that this suppressing of the error would be justified LOGGER.log(Level.FINE, "Script deletion failed", e); } else { Util.displayIOException(e,listener); e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } catch (Exception e) { e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } } /** * Reports the exit code from the process. * * This allows subtypes to treat the exit code differently (for example by treating non-zero exit code * as if it's zero, or to set the status to {@link Result#UNSTABLE}). Any non-zero exit code will cause * the build step to fail. Use {@link #isErrorlevelForUnstableBuild(int exitCode)} to redefine the default * behaviour. * * @since 1.549 */ protected int join(Proc p) throws IOException, InterruptedException { return p.join(); } /** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(@Nonnull FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("hudson", getFileExtension(), getContents(), false); } public abstract String[] buildCommandLine(FilePath script); protected abstract String getContents(); protected abstract String getFileExtension(); private static final Logger LOGGER = Logger.getLogger(CommandInterpreter.class.getName()); } On Wednesday, 16 November 2016 17:15:12 UTC+5:30, Robert Sandell wrote: > > Here are the classes involved in "execute script" step. > > > https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tasks/BatchFile.java > > https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tasks/Shell.java > > https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tasks/CommandInterpreter.java > > /B > > > On Wed, Nov 16, 2016 at 8:41 AM, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > >> If anyone can guide how the windows bactch command execution are handled >> from backend JAVA API. Then I may create one of my own. >> >> On Monday, 14 November 2016 13:37:49 UTC+5:30, Kul Bhushan Srivastava >> wrote: >>> >>> >> >> -- >> 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-de...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/76d6ddbf-14a2-405d-8197-f2dd549e8248%40googlegroups.com >> >&g
Re: How to Add Custom Build Step to behave exactly same as Execute Windows Batch Command.
If anyone can guide how the windows bactch command execution are handled from backend JAVA API. Then I may create one of my own. On Monday, 14 November 2016 13:37:49 UTC+5:30, Kul Bhushan Srivastava wrote: > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/76d6ddbf-14a2-405d-8197-f2dd549e8248%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to Add Custom Build Step to behave exactly same as Execute Windows Batch Command.
-- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/9b976235-21dd-43d3-bccc-1c0b8d8698f4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Plugin to add a custom build step.
Hi, I am willing to put three windows batch command option (one in each optionalblock segment) in custom build step which I have developed. Please find my config,jelly and java code below. What changes I need to done to achieve the same. JAVA File import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import hudson.Extension; import hudson.model.AbstractProject; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.Builder; import hudson.util.FormValidation; public class BuildStepCreator extends Builder { private String text, text1, text2; public String getText(){ return text; } public String getText1(){ return text1; } public String getText2(){ return text2; } @DataBoundConstructor public BuildStepCreator(OptinalTextBlock enableText, OptinalTextBlock1 enableText1, OptinalTextBlock2 enableText2) { this.text = (enableText != null) ? enableText.text : null; this.text1 = (enableText != null) ? enableText1.text1 : null; this.text2 = (enableText != null) ? enableText2.text2 : null; } public static class OptinalTextBlock { private String text; @DataBoundConstructor public OptinalTextBlock(String text) { this.text = text; } } public static class OptinalTextBlock1 { private String text1; @DataBoundConstructor public OptinalTextBlock1(String text1) { this.text1 = text1; } } public static class OptinalTextBlock2 { private String text2; @DataBoundConstructor public OptinalTextBlock2(String text2) { this.text2 = text2; } } @Override public boolean perform(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener) { listener.getLogger().println("OptionalBlockSampleBuilder " + text); return true; } @Extension public static final class DescriptorImpl extends BuildStepDescriptor{ /*public FormValidation doCheckTask(@QueryParameter String value){ try{ if(value.equalsIgnoreCase(null) || value.equalsIgnoreCase("")){ return FormValidation.error("Invalid Details."); } }catch(Exception e){ return FormValidation.error("Error validating the form details."); } return FormValidation.ok(); } public FormValidation doCheckGoal(@QueryParameter String value){ try{ Integer.parseInt(value); }catch(Exception e){ return FormValidation.error("Please provide integer in the Goal."); } return FormValidation.ok(); }*/ @Override public boolean isApplicable(Class jobType) { // TODO Auto-generated method stub return true; } @Override public String getDisplayName() { // TODO Auto-generated method stub return "Job Orchectration"; } } } config.jelly On Monday, 24 October 2016 13:43:14 UTC+5:30, Kul Bhushan Srivastava wrote: > > Thanks for suggestions. I am able to build a custom build step now > successfully. Final code looks like this. > > JAVA File > > import org.kohsuke.stapler.DataBoundConstructor; > import org.kohsuke.stapler.QueryParameter; > > import hudson.Extension; > import hudson.model.AbstractProject; > import hudson.tasks.BuildStepDescriptor; > import hudson.tasks.Builder; > import hudson.util.FormValidation; > > public class BuildStepCreator extends Builder { > > private String text, text1, text2; > > public String getText(){ > return text; > } > public String getText1(){ > return text1; > } > public String getText2(){ > return text2; > } > > > @DataBoundConstructor > public BuildStepCreator(OptinalTextBlock enableText, OptinalTextBlock1 > enableText1, OptinalTextBlock2 enableText2) { > this.text = (enableText != null) ? enableText.text : null; > this.text1 = (enableText != null) ? enableText1.text1 : null; > this.text2 = (enableText != null) ? enableText2.text2 : null; > } > > public static class OptinalTextBlock { > private String text; > @DataBoundConstructor > public OptinalTextBlock(String text) { > this.text = text; > } >
Re: Plugin to add a custom build step.
Thanks for suggestions. I am able to build a custom build step now successfully. Final code looks like this. JAVA File import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import hudson.Extension; import hudson.model.AbstractProject; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.Builder; import hudson.util.FormValidation; public class BuildStepCreator extends Builder { private String text, text1, text2; public String getText(){ return text; } public String getText1(){ return text1; } public String getText2(){ return text2; } @DataBoundConstructor public BuildStepCreator(OptinalTextBlock enableText, OptinalTextBlock1 enableText1, OptinalTextBlock2 enableText2) { this.text = (enableText != null) ? enableText.text : null; this.text1 = (enableText != null) ? enableText1.text1 : null; this.text2 = (enableText != null) ? enableText2.text2 : null; } public static class OptinalTextBlock { private String text; @DataBoundConstructor public OptinalTextBlock(String text) { this.text = text; } } public static class OptinalTextBlock1 { private String text1; @DataBoundConstructor public OptinalTextBlock1(String text1) { this.text1 = text1; } } public static class OptinalTextBlock2 { private String text2; @DataBoundConstructor public OptinalTextBlock2(String text2) { this.text2 = text2; } } @Override public boolean perform(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener) { listener.getLogger().println("OptionalBlockSampleBuilder " + text); return true; } @Extension public static final class DescriptorImpl extends BuildStepDescriptor{ /*public FormValidation doCheckTask(@QueryParameter String value){ try{ if(value.equalsIgnoreCase(null) || value.equalsIgnoreCase("")){ return FormValidation.error("Invalid Details."); } }catch(Exception e){ return FormValidation.error("Error validating the form details."); } return FormValidation.ok(); } public FormValidation doCheckGoal(@QueryParameter String value){ try{ Integer.parseInt(value); }catch(Exception e){ return FormValidation.error("Please provide integer in the Goal."); } return FormValidation.ok(); }*/ @Override public boolean isApplicable(Class jobType) { // TODO Auto-generated method stub return true; } @Override public String getDisplayName() { // TODO Auto-generated method stub return "Job Orchectration"; } } } config.jelly On Tuesday, 18 October 2016 16:45:16 UTC+5:30, Daniel Beck wrote: > > > > On 17.10.2016, at 20:07, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > > > > Please suggest. > > I don't know what else is wrong. Compare what you did with the mvn hpi > plugin archetype, it basically does exactly what you're doing, and it > works. > > mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create > > FWIW it seems insane to upload plugins you don't even know are working to > Jenkins. Just debug them locally. You won't have to restart Tomcat then to > apply changes. > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/27bd4568-fa43-4fc8-86f8-68179eeb789b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Plugin to add a custom build step.
Hi Daniel, I have made my changes as suggested by You. Now my java file looks like. import hudson.task.Builder; import org.kohsuke.stapler.DataBoundConstructor; public class BuildStepCreation extends Builder{ private final String task; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor public BuildStepCreation(String task) { this.task = task; } /** * We'll use this from the config.jelly. */ public String getTask(){ return task; } @Extension //This indicates to Jenkins that this is an implementation of an extension point. public static class Descriptor extends BuildStepDescriptor { @Override public boolean isApplicable(Class jobType) { //return FreeStyleProject.class.isAssignableFrom(jobType); // Indicates that this builder can be used with all kinds of project types. return true; } @Override public String getDisplayName() { //This human readable name is used in the configuration screen. return "Job Orchestration"; } } } My *config.jelly* file looks like which sits in *com.oracle.siebel.jenkins.BuildStepCreation* under resources folder. I am building a *.hpi *file from my workbenck(Eclipse) and uploading the same on the jenkins server instance running on tomcat through Manage Jenkins link. The information in *index.jelly* about the plugin description is getting read by the Jenkins and it is displaying under Installed Plugins as well. But the custom build step is not populating in the drop down list. Please suggest. On Monday, 17 October 2016 13:38:56 UTC+5:30, Daniel Beck wrote: > > > > On 17.10.2016, at 08:23, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > > > > public String getTask() { > > @Extension > > public static class Descriptor extends > BuildStepDescriptor { > > Correction, the descriptor (second listing) is there, but not done > correctly. > > The static nested class needs to be a 'sibling' of getTask(), not a > 'child'. > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/f73d33c0-6fd1-4ddf-b106-ffa4f550fed8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Plugin to add a custom build step.
Hi Daniel, I have made my changes as suggested by You. Now my java file looks like. import hudson.task.Builder; import org.kohsuke.stapler.DataBoundConstructor; public class BuildStepCreation extends Builder{ private final String task; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor public BuildStepCreation(String task) { this.task = task; } /** * We'll use this from the config.jelly. */ public String getTask(){ return task; } @Extension //This indicates to Jenkins that this is an implementation of an extension point. public static class Descriptor extends BuildStepDescriptor { @Override public boolean isApplicable(Class jobType) { //return FreeStyleProject.class.isAssignableFrom(jobType); // Indicates that this builder can be used with all kinds of project types. return true; } @Override public String getDisplayName() { //This human readable name is used in the configuration screen. return "Job Orchestration"; } } } My *config.jelly* file looks like which sits in *com.oracle.siebel.jenkins.BuildStepCreation* under resources folder. I am building a *.hpi *file from my workbenck(Eclipse) and uploading the same on the jenkins server instance running on tomcat through Manage Jenkins link. The information in *index.jelly* about the plugin description is getting read by the Jenkins and it is displaying under Installed Plugins as well. But the custom build step is not populating in the drop down list. Please suggest. On Monday, 17 October 2016 13:38:56 UTC+5:30, Daniel Beck wrote: > > > > On 17.10.2016, at 08:23, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > > > > public String getTask() { > > @Extension > > public static class Descriptor extends > BuildStepDescriptor { > > Correction, the descriptor (second listing) is there, but not done > correctly. > > The static nested class needs to be a 'sibling' of getTask(), not a > 'child'. > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1d1ca7c1-819f-4706-8d64-e0d20d9a3ada%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Plugin to add a custom build step.
Hi Daniel, I have made my changes as suggested by You. Now my java file looks like. package com.oracle.siebel.jenkins; import hudson.task.Builder; import org.kohsuke.stapler.DataBoundConstructor; public class BuildStepCreation extends Builder{ private final String task; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor public BuildStepCreation(String task) { this.task = task; } /** * We'll use this from the config.jelly. */ public String getTask(){ return task; } @Extension //This indicates to Jenkins that this is an implementation of an extension point. public static class Descriptor extends BuildStepDescriptor { @Override public boolean isApplicable(Class jobType) { //return FreeStyleProject.class.isAssignableFrom(jobType); // Indicates that this builder can be used with all kinds of project types. return true; } @Override public String getDisplayName() { //This human readable name is used in the configuration screen. return "Job Orchestration"; } } } My *config.jelly* file looks like which sits in *com.oracle.siebel.jenkins.BuildStepCreation* under resources folder. I am building a *.hpi *file from my workbenck(Eclipse) and uploading the same on the jenkins server instance running on tomcat through Manage Jenkins link. The information in *index.jelly* about the plugin description is getting read by the Jenkins and it is displaying under Installed Plugins as well. But the custom build step is not populating in the drop down list. Please suggest. On Monday, 17 October 2016 13:38:56 UTC+5:30, Daniel Beck wrote: > > > > On 17.10.2016, at 08:23, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > > > > public String getTask() { > > @Extension > > public static class Descriptor extends > BuildStepDescriptor { > > Correction, the descriptor (second listing) is there, but not done > correctly. > > The static nested class needs to be a 'sibling' of getTask(), not a > 'child'. > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c5236d52-8401-4ad3-96fe-087a8e711d44%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Plugin to add a custom build step.
Hi Daniel, Thanks for your response. I am using the sample java code demonstrated in the following link https://wiki.jenkins-ci.org/display/JENKINS/Create+a+new+Plugin+with+a+custom+build+Step <https://www.google.com/url?q=https%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FCreate%2Ba%2Bnew%2BPlugin%2Bwith%2Ba%2Bcustom%2Bbuild%2BStep=D=1=AFQjCNFs_7mSv_X_Hn9RX0Jc16lbaysCLQ> to build my custom build step. POM.xml is same as described here except parent section version tag. In my case it is 1.420 instead of 1.400 I have did this change to resolve one of the ClassNotFound exception while using version 1.400 I have build the maven project using https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial for my Eclipse IDE. The java code looks like import hudson.task.Builder; import org.kohsuke.stapler.DataBoundConstructor; public class BuildStepCreation extends Builder{ private final String task; @DataBoundConstructor public BuildStepCreation(String task) { this.task = task; } public String getTask() { @Extension public static class Descriptor extends BuildStepDescriptor { @Override public boolean isApplicable(Class jobType) { return FreeStyleProject.class.isAssignableFrom(jobType); } @Override public String getDisplayName() { return "Job Orchestration"; } } } } On Saturday, 15 October 2016 22:30:12 UTC+5:30, Daniel Beck wrote: > > > > On 15.10.2016, at 17:36, Kul Bhushan Srivastava <cool...@gmail.com > > wrote: > > > > the same is not achieved > > You need to provide much more information than this. > > http://www.catb.org/~esr/faqs/smart-questions.html#beprecise > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/525f6f7f-d9fd-4af0-9dba-29b10282b7f2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Plugin to add a custom build step.
I gone through the following URL https://wiki.jenkins-ci.org/display/JENKINS/Create+a+new+Plugin+with+a+custom+build+Step and implemented the same to develop my own custom plugin but the same is not achieved. Jenkins version : 1.651.1 Please help. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c44801c1-05c6-4ad4-95f8-cc8984f7c4db%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.