Reputation: 10537
I have an Angular app myApp
which we have to wrap into a .war
file for deployments. For that reason, we use maven-release-plugin
which releases the generated myApp.war
file to Nexus releases.
maven-release-plugin
will call exec-maven-plugin
which has <execution>
section to configure exec goal like below to call npm install
and npm build
commands:
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-run</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
When I issue mvn release:prepare
, it will eventually call exec-maven-plugin
which will issue npm install
and npm build
commands.
The problem I am facing is that while these commands execute successfully, they will generate a few messages, however, maven interprets these warning messages as error messages. This, although it succeeds, generates logs that send red flags because they are interpreted as errors.
For example, here are a few warnings that are interpreted as errors when npm install
is called:
[INFO] [INFO] --- exec-maven-plugin:3.4.1:exec (npm-install) @ myApp ---
...
[ERROR] npm WARN deprecated [email protected]: This package is no longer supported.
[ERROR] npm WARN deprecated [email protected]: This package is now published under @cucumber/gherkin
[ERROR] npm WARN deprecated [email protected]: This package is now published under @cucumber/cucumber-expressions
Solution to the above npm WARN messages being represented as maven ERROR messages I found is to add two more arguments (--loglevel and error) after the install argument as below:
...
<argument>install</argument>
<argument>--loglevel</argument>
<argument>error</argument>
...
However, I cannot find solution to the below problem where regular ng build steps echo statements get treated as maven ERROR messages.
Here are the lines ng build echoes, these are just regular step execution echo statements, not errors, not warnings but maven interprets them as errors when ng build
is called:
[INFO] [INFO] --- exec-maven-plugin:3.4.1:exec (npm-run) @ myApp ---
[INFO]
[INFO] > [email protected] build-prod
[INFO] > ng build --configuration production
[INFO]
[ERROR] - Generating browser application bundles (phase: setup)...
[ERROR] Processing legacy "View Engine" libraries:
[ERROR] - @ng-idle/core [es2015/esm2015] (git+https://github.com/moribvndvs/ng2-idle.git)
[ERROR] Encourage the library authors to publish an Ivy distribution.
[ERROR] ✔ Browser application bundle generation complete.
[ERROR] ✔ Browser application bundle generation complete.
[ERROR] - Copying assets...
[ERROR] ✔ Copying assets complete.
[ERROR] - Generating index html...
[ERROR] ✔ Index html generation complete.
Note: This is not related to similar SO questions having same issue with frontend-maven-plugin
. I cannot use frontend-maven-plugin
.
Upvotes: 0
Views: 46