Apache Camel:m2e忽略了maven-remote-resources-plugin(目标"进程")

Rem*_*mmi 7 eclipse apache pom.xml maven m2e

我正在做一个骆驼项目.我开始采用骆驼示例,在shell中运行"mvn eclipse:eclipse",然后将其作为maven项目导入Eclipse.不幸的是,我在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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.camel</groupId>
        <artifactId>examples</artifactId>
        <version>2.13.0</version>
    </parent>

    <artifactId>CruiserFoodSupply</artifactId>
    <packaging>jar</packaging>
    <name>Cruiser Food Supply</name>
    <description>A process on how food supply on a cruiser works.</description>

    <dependencies>

        <!-- Camel dependencies -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jms</artifactId>
        </dependency>
        <!-- Mail -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-mail</artifactId>
        </dependency>
        <!-- XStream -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-xstream</artifactId>
        </dependency>
        <!-- Weather -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-weather</artifactId>
        </dependency>
        <!-- Many more dependencies-->

    </dependencies>


    <profiles>
        <profile>
            <id>Example</id>
            <properties>
                <target.main.class>org.apache.camel.example.jmstofile.CamelJmsToFileExample</target.main.class>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <!-- Allows the example to be run via 'mvn compile exec:java' -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <configuration>
                    <mainClass>${target.main.class}</mainClass>
                    <includePluginDependencies>false</includePluginDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
Run Code Online (Sandbox Code Playgroud)

Eclipse在其显示的行中显示警告,<parent>警告为:

maven-remote-resources-plugin (goal "process") is ignored by m2e.
Run Code Online (Sandbox Code Playgroud)

如何摆脱这种警告?

小智 4

所有这些都在http://wiki.eclipse.org/M2E_plugin_execution_not_covered上进行了解释。基本上这个 Maven 插件在 Eclipse 构建的上下文中是有问题的。

该消息源自 Eclipse 默认生命周期映射,您可以覆盖该映射。我基本上从默认生命周期映射中复制了一个片段,并<message>...</message><ignore>元素中删除了

我有 m2e v1.4.0.20130601-0317 (我认为这是 eclipse 4.3 Kepler 附带的版本),我有两个选项:“工作空间生命周期映射元数据”文件或只是 pom.xml 中的插件配置。

1.工作空间生命周期映射元数据

<workspace>\.metadata\.plugins\org.eclipse.m2e.core\lifecycle-mapping-metadata.xml您只需创建一个包含以下内容的文件:

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <versionRange>[1.0,)</versionRange>
                <goals>
                    <goal>process</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore>
                </ignore>
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>
Run Code Online (Sandbox Code Playgroud)

然后,您必须进入首选项,并在 Maven/生命周期映射下单击“重新加载工作区生命周期映射元数据”按钮。之后,您必须更新您的 Maven 项目(Maven/Update Project...)

2.pom.xml

或者您可以直接在 pom.xml 中执行此操作,这样其他开发人员也可以从中受益:

<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-remote-resources-plugin</artifactId>
                                <versionRange>[1.0,)</versionRange>
                                <goals>
                                    <goal>process</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <ignore>
                                </ignore>
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>
Run Code Online (Sandbox Code Playgroud)