我正在开发一个Camel项目。我开始采用骆驼示例,在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>
Eclipse在显示<parent>
的行中显示警告,警告为:
maven-remote-resources-plugin (goal "process") is ignored by m2e.
如何摆脱这种警告?
答案 0 :(得分:3)
所有这些都在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中的插件配置。
您只需使用以下内容创建文件<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>
然后您进入首选项并在Maven / Lifecycle Mappings下单击“Reload workspace lifecycle mappings metadata”按钮。之后,您必须更新您的maven项目(Maven / Update Project ...)
或者您可以直接在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>
答案 1 :(得分:2)
如果remote-resources:process
是项目构建中的关键步骤,并且您不希望忽略该目标,则可以为maven-remote-resources-plugin安装m2e-connector和删除已添加到pom文件中的所有生命周期映射元数据。
https://github.com/coderplus/m2e-connector-for-maven-remote-resources-plugin
连接器还可以处理远程资源:maven-remote-resources-plugin的bundle目标
免责声明:我是连接器的作者; - )