Solved: In case you encounter a CreateProcess error=206 when starting your

This is a writeup of a problem I had for anyone to stumble upon later.

I recently experienced a problem when starting my Spring Boot-based V14 application from Jenkins under Windows.

As part of a one-click pipeline in a Jenkinsfile, I stop the running application, check out the code base, build a new snapshot, install it as a Windows Service with nssm and start the service again. The service starts the application via: mvn spring-boot:run -Ptest. The whole setup works well, until fairly recently. After rerouting the Windows Service’s AppStdout and AppStderr to a file, I could see what was happing. The mvn/java command failed with a "CreateProcess error=206".

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.0.RELEASE:run (default-cli) on project application-ui: Could not exec java: Cannot run program "C:\opt\jdk-13\bin\java.exe" (in directory "c:\opt\Jenkins\workspace\application_master\application-ui"): CreateProcess error=206, The filename or extension is too long -> [Help 1] .

Via mvn dependency:tree, I was able to see that a ‘small’ component I had added recently added 108 (!) extra dependencies. All in all, this was too much for the application to start. Be advised.

Thanks for sharing!

What is the ultimate fix for this? This is a problem for us on developer machines that are running windows. Eliminating dependencies simply because they make the path too long isn’t really a solution. We have multiple projects with this error. Can the mvn wrapper script be modified to point to a different repository location?

Steven Z:
What is the ultimate fix for this? This is a problem for us on developer machines that are running windows. Eliminating dependencies simply because they make the path too long isn’t really a solution. We have multiple projects with this error. Can the mvn wrapper script be modified to point to a different repository location?

Difficult to say, but a good grasp on the components needed is a valuable step.

Why do you have so many dependencies? Which could you do without…?

Mark HM:

Steven Z:
What is the ultimate fix for this? This is a problem for us on developer machines that are running windows. Eliminating dependencies simply because they make the path too long isn’t really a solution. We have multiple projects with this error. Can the mvn wrapper script be modified to point to a different repository location?

Difficult to say, but a good grasp on the components needed is a valuable step.

Why do you have so many dependencies? Which could you do without…?

I did find a fix, disabling forking in the spring-boot-maven-plugin via false allows me to run the app now.

I do have a lot of spring-boot dependencies such as spring-security-config, spring-boot-starter-web, and several others in my POM that’s grown over time. I wonder if they can be reduced via a single higher level spring dependency?