1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

exec-maven-plugin interprets npm and ng warnings as errors

Discussão em 'Angular' iniciado por pixel, Outubro 7, 2024 às 13:23.

  1. pixel

    pixel Guest

    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 gauge@4.0.4: This package is no longer supported.
    [ERROR] npm WARN deprecated gherkin@5.1.0: This package is now published under @cucumber/gherkin
    [ERROR] npm WARN deprecated cucumber-expressions@5.0.18: This package is now published under @cucumber/cucumber-expressions


    And here are some messages that are not even warnings but are interpreted as errors when ng build is called:

    [INFO] [INFO] --- exec-maven-plugin:3.4.1:exec (npm-run) @ myApp ---
    [INFO]
    [INFO] > myApp@0.0.9 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.

    Continue reading...

Compartilhe esta Página