1

I use maven to combine angular application with java. Part of pom looks like this

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.5.0</version>
            <executions>
                <execution>
                    <id>exec-npm-install</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <workingDirectory>${project.basedir}/src/main/angular-app</workingDirectory>
                        <executable>npm.cmd</executable>
                        <arguments>
                            <argument>install</argument>
                        </arguments>
                    </configuration>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
                <execution>
                    <id>exec-npm-ng-build</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <workingDirectory>${project.basedir}/src/main/angular-app</workingDirectory>
                        <executable>ng.cmd</executable>
                        <arguments>
                            <argument>build</argument>
                            <argument>--base-href=/testangularmaven/src/main/webapp/angular_build/</argument>
                        </arguments>
                    </configuration>
                    <goals>
                        <goal>exec</goal>
                    </goals>

                </execution>

            </executions>
        </plugin>       

mvn package works well and project is compiled in war file, but eclipse says that pom is not correct. Solution to use tags pluginManagement doesn't match due to it will not be executed commands. How to fix problem with eclipse?

Andrey
  • 158
  • 2
  • 11
  • See https://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin – Tome Jun 02 '17 at 07:53
  • - pligin management doesn't solve in mycase, due to when you use it commands will not be executed, Iread this post and tryed some solutions. What solution do you reccomend exactly? – Andrey Jun 02 '17 at 08:01
  • Eclipse doesn't know how to translate the exec-maven-plugin into an Eclipse build action. Solutions linked are talking about telling Eclipse to ignore it, and also point to other possibilities that might be usable or not depending on your Eclipse version – Tome Jun 02 '17 at 08:07

1 Answers1

1

Solved by mapping

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <versionRange>[1.5.0,)</versionRange>
                <goals>
                    <goal>exec</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <execute />
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>
Andrey
  • 158
  • 2
  • 11
  • answer incomplete. also refer https://stackoverflow.com/questions/30063357/how-can-i-map-maven-lifecycle-phases-not-covered-by-the-eclipse-m2e-plugin. Also if your project is set to auto-build, then running npm builds would be pretty annoying. I'd rather set the action to ignore – Monish Sen Apr 07 '20 at 23:57