【问题标题】:How to solve Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:exec-maven- plugin:1.5.0:exec?如何解决生命周期配置未涵盖的插件执行:org.codehaus.mojo:exec-maven-plugin:1.5.0:exec?
【发布时间】:2017-11-03 12:19:05
【问题描述】:

我使用 maven 将 Angular 应用程序与 java 结合起来。 pom的一部分是这样的

<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 包运行良好,项目在 war 文件中编译,但 eclipse 说 pom 不正确。使用标签 pluginManagement 的解决方案不匹配,因为它不会被执行命令。 如何解决eclipse的问题?

【问题讨论】:

  • - 插件管理在我的情况下没有解决,因为当你使用它时,命令不会被执行,我阅读了这篇文章并尝试了一些解决方案。您具体推荐什么解决方案?
  • Eclipse 不知道如何将 exec-maven-plugin 转换为 Eclipse 构建操作。链接的解决方案正在谈论告诉 Eclipse 忽略它,并指出其他可能可用或不可用的可能性,具体取决于您的 Eclipse 版本

标签: maven eclipse-plugin


【解决方案1】:

通过映射解决

<?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>

【讨论】:

  • 回答不完整。另请参阅stackoverflow.com/questions/30063357/…。此外,如果您的项目设置为自动构建,那么运行 npm 构建将非常烦人。我宁愿将动作设置为忽略
猜你喜欢
  • 2017-10-17
  • 2011-10-10
  • 2020-04-19
  • 2016-10-26
  • 1970-01-01
  • 2016-05-28
  • 2013-10-08
  • 2013-01-28
  • 2011-09-15
相关资源
最近更新 更多