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<Builder>{
        
        /*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<? extends AbstractProject> 
jobType) {
            // TODO Auto-generated method stub
            return true;
        }

        @Override
        public String getDisplayName() {
            // TODO Auto-generated method stub
            return "Job Orchectration";
        }
        
    }
}

config.jelly

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
  <f:block>
        <f:optionalBlock name="enableText" title="Test Execution - 
PresetUp" checked="${instance.text != null}">
            <f:entry title="Command" field="text">
                <f:textarea />
            </f:entry>
        </f:optionalBlock>
  </f:block>
  <f:block>
        <f:optionalBlock name="enableText1" title="Execute Test" 
checked="${instance.text1 != null}">
            <f:entry title="Command" field="text1">
                <f:textarea />
            </f:entry>
        </f:optionalBlock>
  </f:block>
  <f:block>
        <f:optionalBlock name="enableText2" title="Post-Run Cleanup" 
checked="${instance.text2 != null}">
            <f:entry title="Command" field="text2">
                <f:textarea />
            </f:entry>
        </f:optionalBlock>
  </f:block>
</j: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 
> <javascript:>> 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.

Reply via email to