ERROR: CreateProcess error=193, %1 is not a valid Win32 application

Trying to import libraries through Jenkinsfile for a pipeline created. It is throwing an error that it cannot run program ‘maven’ as is not a valid Win32 application .

ERROR MESSAGE:
=> Using C:\Java\apache-maven-3.9.0\bin\mvn for downloading library
java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:487)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
Caused: java.io.IOException: Cannot run program “C:\Java\apache-maven-3.9.0\bin\mvn”: CreateProcess error=193, %1 is not a valid Win32 application
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at com.roylenferink.jenkins.plugins.workflow.libs.NexusRetriever.retrieve(NexusRetriever.java:154)
at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:260)
at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:150)
at org.jenkinsci.plugins.workflow.libs.LibraryDecorator$1.call(LibraryDecorator.java:125)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:190)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:175)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:569)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:519)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:336)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: Loading libraries failed

Open a bug for the plugin in Jira. From looking at the code I have the impression that the plugin doesn’t properly take into account that you’re running on windows.
It tries to run C:\Java\apache-maven-3.9.0\bin\mvn but that is a unix shell script and not a windows batch. It should use C:\Java\apache-maven-3.9.0\bin\mvn.cmd

1 Like

For further clarity, that stack trace seems to indicate that you’re using the Pipeline: Shared Groovy Libraries through Nexus retrieval plugin and it is failing.

Issue reports for that plugin are submitted through GitHub.

1 Like