简体   繁体   中英

exec-maven-plugin cannot run “mvn” command on Windows machine

I have a Spring Boot 2 project which is a ReST API, and I am using Spring Rest.

I am using 2 plugins to generate an SDK other projects to import to call my API. The first plugin is com.github.kongchen:swagger-maven-plugin:3.17 to generate the swagger-codegen-spec file, and the second is org.openapitools:openapi-generator-maven-plugin:3.2.3 to then generate the actual SDK files as another mvn project.

Finally, I have automated component tests that use that SDK to run tests against the running API.

My goal, is to actually BUILD the SDK as part of the original project build. So when I run "mvn install" on my-api-project, I end up with the web-app jar AND the sdk jar when it is complete, without having to run "mvn install" on the SDK as a secondary step.

I've successfully accomplished this on Linux/Mac in 2 different ways. First was to use the antrun plugin. However, this did not work on my co-worker's Windows 10, 64 bit machine. He was getting many issues regarding invalid directories and shell not being installed, etc.

So I tried using the exec-maven-plugin instead, which seems to be a lot cleaner, and more OS agnostic. Again, this works great in Linux/Max, but in Windows, now we get this error:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (build swagger-codegen sources) on project my-api: Command execution failed.: Cannot run program "C:\\Program Files\\Apache\\maven\\bin\\mvn" (in directory "C:\\Users\\user1\\Documents\\GitHub\\my-project\\my-java-sdk"): CreateProcess error=193, %1 is not a valid Win32 application -> [Help 1]

When he uses the cmd window he can run "mvn install" in that directory just fine.

Any ideas??

This error was fixed by upgrading the exec-maven-plugin version to the latest version. Spring Boot was supplying the version, which was 1.5.0, but the latest is 1.6.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM