micronaut-projects / micronaut-core

Micronaut Application Framework
http://micronaut.io
Apache License 2.0
6.08k stars 1.07k forks source link

micronaut-parent parent pom and exec-maven-plugin #7339

Closed asautins closed 2 years ago

asautins commented 2 years ago

Expected Behavior

I am adding some steps to include a react frotend build in my pom.xml file, generally following the example here:

https://www.wissel.net/blog/2021/12/deploying-your-frontend-as-webjar.html

The expected behavior is I add the following rule:

          <execution>
            <id>npm install (clean)</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>pre-clean</phase>
            <configuration>
              <executable>npm</executable>
              <arguments>
                <argument>install</argument>
              </arguments>
            </configuration>
          </execution>

That it runs successfully

Actual Behaviour

The actual behavior is the rule fails. When run with the -X flag I see the following error:

npm ERR! errno -36
npm ERR! ENAMETOOLONG: name too long, open 

It appears the parent pom defines the following

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>${exec-maven-plugin.version}</version>
          <configuration>
            <arguments>
              <argument>-classpath</argument>
              <classpath/>
              <argument>-XX:TieredStopAtLevel=1</argument>
              <argument>-Dcom.sun.management.jmxremote</argument>
              <argument>${exec.mainClass}</argument>
            </arguments>
          </configuration>
        </plugin>

Which seems to add the classpath and additional variables to the end of exec:exec rules.

Steps To Reproduce

execute mvn clean on the following pom will result in a failure.

?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>testproject</artifactId>
  <version>0.1</version>
  <packaging>jar</packaging>
  <parent>
    <groupId>io.micronaut</groupId>
    <artifactId>micronaut-parent</artifactId>
    <version>3.4.3</version>
  </parent>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>npm install (clean)</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>pre-clean</phase>
            <configuration>
              <executable>npm</executable>
              <arguments>
                <argument>install</argument>
                <argument> </argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Environment Information

No response

Example Application

No response

Version

3.4.3

alvarosanchez commented 2 years ago

You need to define your exec-maven-plugin configuration node like this:

<configuration combine.self="override">
asautins commented 2 years ago

That works great. thank you!