I try to deploy a npm module
via exec-maven-plugin
. I use the nexus-npm
tool from https://github.com/arkanjoms/nexus-npm.
In my pom I execute it like this:
<execution>
<id>Deploy module via nexus-npm</id>
<goals>
<goal>exec</goal>
</goals>
<phase>deploy</phase>
<configuration>
<workingDirectory>${project.build.directory}/npm</workingDirectory>
<executable>nexus-npm</executable>
<arguments>
<argument>deploy</argument>
</arguments>
<environmentVariables>
<HOME>${project.build.directory}/npm</HOME>
</environmentVariables>
</configuration>
</execution>
Everything works fine, but when the deployment is failing the maven build is still marked as successful. How can I tell maven that the build should fail when the deployment is not successful?
npm ERR! publish Failed PUT 400
npm ERR! code E400
npm ERR! Repository is read only: npm-internal-snapshots : mypackage
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Apps\npm-cache\_logs\2019-06-12T11_02_39_129Z-debug.log
[default.js-info]: Rollback files.
[default.js-info]: Cleaning files.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:12 min (Wall Clock)
[INFO] Finished at: 2019-06-12T13:02:39+02:00
[INFO] Final Memory: 43M/396M
[INFO] ------------------------------------------------------------------------
To clearify I know why the deployment is failing, that is not my question. I only want to know how to mark the maven build as failure when the deployment has an error.