Hello
you probably want to use 
https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#isunix-checks-if-running-on-a-unix-like-node


On Saturday, 23 January 2021 at 21:19:43 UTC+1 [email protected] wrote:

>
> Hi,
>
> I've got a pipeline file, that should be executable on a Windows build 
> server, and on a Linux build server. The pipeline is launching Maven as 
> follows:
>
> On Linux:
>
>     sh "mvn <MAVEN_OPTIONS>"
>
> But on Windows, this appears not to work, so I've got to use:
>
>    bat "mvn.cmd <MAVEN_OPTIONS>" 
>
> Right now, I can use either of these steps, so have to choose between 
> Windows, and Linux. Is there any possibility to get this portable? I am 
> thinking something like
>
>    if (isWindows()) {
>        bat "mvn.cmd <MAVEN_OPTIONS>" 
>    } else {
>     sh "mvn <MAVEN_OPTIONS>"
>    }
>
> Thanks,
>
> Jochen
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/9e11dd3d-e291-4fa7-8af8-a1bb36e74a6an%40googlegroups.com.

Reply via email to