0

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??

Nephthys76
  • 615
  • 2
  • 8
  • 23
  • Do you have Windows 32 bit installed? – Simon Martinelli Sep 20 '18 at 06:52
  • @SimonMartinelli no, the Windows machine is Windows 10 - 64 bit. And the CPU is 64 bit. (Actually, this is my coworker's machine. I always use Mac or Linux, so I am struggling with getting this build working on his machine.) – Nephthys76 Sep 20 '18 at 16:31
  • You could try the usual `c:\somewhere\cmd.exe /k C:\Program Files\Apache\maven\bin\mvn.cmd` stuff – Marged Sep 20 '18 at 16:51
  • And you should read this: https://stackoverflow.com/questions/18724226/why-shouldnt-i-put-spaces-in-my-maven-path-in-windows – Marged Sep 20 '18 at 16:53
  • Thanks @Marged... I don't understand why your first suggestion would be necessary. We can already successfully run maven in the cmd window manually. It only fails when the exec-maven-plugin calls it. I will suggest to my co-worker to move his mvn install to a location without spaces in the path. – Nephthys76 Sep 20 '18 at 17:14

1 Answers1

0

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.

Nephthys76
  • 615
  • 2
  • 8
  • 23