Thanks for response Jesse,
Yes i saw that @StepContextParameter  is deprecated . i have basically two 
builder classes extending SimpleBuildStep which basically invokes our tool 
through command line. Before that i have Build wrapper class extending 
SimpleBuildWrapper which makes sure that the tools path is added in 'PATH' 
variable . 

problem is above works fine when run using freestyle project however when i 
cosnstruct a pipeline DSL code then builder fails to invoke the tool as my 
build step in pipeline does not know where my tool is . (even though it is 
set in my BuildWrapper class). Please help me with this i have been stuck 
on this issue from quite a time now . not sure what am i doing wrong here , 
attaching link to my project 

https://github.com/mathworks/jenkins-matlab-plugin/tree/2.0.0-Qualification/src/main/java/com/mathworks/ci

please check 
*Build Wrapper Class*
UseMatlabVersionBuildWrapper.java 
<https://github.com/mathworks/jenkins-matlab-plugin/blob/2.0.0-Qualification/src/main/java/com/mathworks/ci/UseMatlabVersionBuildWrapper.java>
 which 
is my build Wrapper class. 

*Builder Classes *

RunMatlabCommandBuilder.java 
<https://github.com/mathworks/jenkins-matlab-plugin/blob/2.0.0-Qualification/src/main/java/com/mathworks/ci/RunMatlabCommandBuilder.java>
RunMatlabTestsBuilder.java 
<https://github.com/mathworks/jenkins-matlab-plugin/blob/2.0.0-Qualification/src/main/java/com/mathworks/ci/RunMatlabTestsBuilder.java>
 



pipeline code that i am trying but does not work is as below.

pipeline {
    agent any
    stages{
        stage('Run MATLAB Command') {
            steps 
            {
                Matlab(matlabRootFolder:'C:\\Program Files\\MATLAB\\R2019b')
                {
                        RunMatlabCommand(matlabCommand:'ver;pwd')

                       // is i replace above step with echo bat('cmd.exe /C 
matlab -batch pwd') then it works
                }
                
            }
                 
        }
    }
}


On Tuesday, 17 March 2020 00:03:38 UTC+5:30, Jesse Glick wrote:
>
> On Mon, Mar 16, 2020 at 7:57 AM Nikhil Bhoski <[email protected] 
> <javascript:>> wrote: 
> > i have Builder class which extends SimpleBuildStep and i have 
> SimplebuildWrapper class whcih sets the context envVars. now how should i 
> use @StepContextParameter parameter to pass the EnvVars to my simple build 
> step ? 
>
> This question does not make sense as written. `@StepContextParameter` 
> is a (deprecated!) way to pass a parameter to a Pipeline `Step`. 
> `SimpleBuildStep` & `SimpleBuildWrapper` are ways to create extensions 
> which can work in either traditional or Pipeline builds without 
> Pipeline-specific APIs. 
>
> What are you trying to accomplish? 
>

-- 
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/20daf7f9-dc2f-4fb4-a792-94618b7646e3%40googlegroups.com.

Reply via email to