2011-09-12 62 views
14

我正在嘗試使用maven-warpath-plugin available here。但我不斷收到我的pom.xml文件中的錯誤,內容如下:插件錯誤:執行不在生命週期配置中

Plugin execution not covered by lifecycle configuration: org.appfuse.plugins:maven-warpath-plugin:2.1.0:add-classes (execution: default, phase: generate-sources)

如何解決此問題?這裏是我的插件pom.xml代碼片段:

<plugin> 
    <groupId>org.appfuse.plugins</groupId> 
    <artifactId>maven-warpath-plugin</artifactId> 
    <version>2.1.0</version> 
    <extensions>true</extensions> 
    <executions> 
     <execution> 
      <goals> 
       <goal>add-classes</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 

Eclipse爲我提供了一個quickfox提示「發現新的m2e連接器」來解決此錯誤。我已經安裝了大部分似乎適用的連接器,但錯誤仍然存​​在。任何想法,我可以使這項工作?

回答

29

這是m2e的新的behaviour(它取代了舊的m2eclipse插件)。要指定eclipse應該對插件執行什麼操作,必須在項目的pom.xml中配置構建生命週期映射 - 或者在存在的情況下安裝連接器(它決定插件是否需要在eclipse構建中執行)。

由於maven-warpath-plugin似乎沒有連接器,所以你必須在pom中定義行爲。你可以使用第二個eclipse quickfix(在eclipse build中將pom.xml中的目標add-class永久標記爲忽略)。這將在下一節添加到您的POM:

<build> 
    ...... 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings 
       only. It has no influence on the Maven build itself. --> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId> 
             org.appfuse.plugins 
            </groupId> 
            <artifactId> 
             maven-warpath-plugin 
            </artifactId> 
            <versionRange> 
             [2.1.0,) 
            </versionRange> 
            <goals> 
             <goal>add-classes</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <ignore></ignore> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

,如果你想處理每個Eclipse構建插件,您可以更改<ignore>行動<execute>(上importclean,...)。

插件配置是日食具體不作pom.xml中看起來更好 - 但至少它對Maven的沒有影響建....

+0

@FrVaBe爲此做了第二次eclipse quickfix(在eclipse構建中,將pom.xml中的目標add-classes標記爲忽略)。可以影響我的Web應用程序執行? –

+0

@Amira Manai它不應該影響執行,因爲它對maven構建沒有影響。 – FrVaBe

+0

就我所見,在我的測試中,這種方法是直接從Maven構建中省略maven-warpath-plugin,不是嗎?我的意思是,我希望在我的主戰爭中獲得一個' warpath'神器作爲依賴,它不能被識別。 –

相關問題