2017-06-02 168 views
0

我使用maven将角度应用程序与java结合在一起。 POM的部分看起来像这样如何解决生命周期配置中未包含的插件执行:org.codehaus.mojo:exec-maven-plugin:1.5.0:exec?

<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包装运作良好,并计划在战争文件编译的,但是Eclipse说,POM是不正确的。解决方案使用标签pluginManagement不匹配,因为它不会执行命令。 如何解决eclipse的问题?

+0

参见https://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin – Tome

+0

- pligin管理在mycase中没有解决,因为当你使用它的时候命令将不会被执行,我读过这篇文章并尝试了一些解决方案。你真的推荐什么解决方案? – Andrey

+0

Eclipse不知道如何将exec-maven-plugin转换为Eclipse构建操作。链接的解决方案正在讨论告诉Eclipse忽略它,并指出其他可能可用或不可用的其他可能性,具体取决于您的Eclipse版本 – Tome

回答

0

解决通过映射

<?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> 
相关问题