什么是最简单的插件管理部分可以添加到一个pom,以获得m2e和eclipse靛蓝一起玩?

时间:2012-05-17 12:09:46

标签: m2e

我已阅读有关此主题的讨论,但我没有看到一个简单的解决方案。

鉴于以下非常简单的pom.xml,Indigo Eclipse和m2e(版本0.14.0.201107060316),eclipse抱怨

Multiple annotations found at this line
   - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (execution: default-resources, phase: process-resources)
   - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:testResources (execution: default-testResources, phase: process-test-resources)

<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.mycompany.myproject</groupId>
    <artifactId>myartifact</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>myartifact</name>
    <url>http://maven.apache.org</url>
</project>

我知道这与添加http://wiki.eclipse.org/M2E_plugin_execution_not_covered#execute_plugin_goal

中显示的部分有关

我认为将以下部分添加到pom.xml会清除至少一个错误,但事实并非如此,我不能清楚地了解错误。

有什么建议吗?我相信你们中的一些人很简单。

<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.mycompany.myproject</groupId>
    <artifactId>myartifact</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>myartifact</name>
    <url>http://maven.apache.org</url>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-resources-plugin</artifactId>
                                    <versionRange>2.4.3</versionRange>
                                    <goals>
                                        <goal>resources:resources</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute >
                                        <runOnIncremental>false</runOnIncremental>
                                    </execute >
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</project>

1 个答案:

答案 0 :(得分:1)

我面临同样的问题(Eclipse Indigo,Maven 3.0.2)。我按照这里指出的步骤解决了它: http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven

我安装了以下功能(使用eclipse-&gt; Help-&gt;安装新软件): - Eclipse的Maven集成 - 针对WTP的Maven集成 从这里: http://download.jboss.org/jbosstools/updates/m2eclipse-wtp

一旦我安装了这些功能,我就会更新项目(右键在项目上 - &gt; Maven-&gt;更新项目..)。这对我有用。我希望这可以提供帮助。