问题: maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.
两种解决方案:
方案1;
这次换了个64位全新笔记本,装了最新的Eclipse Indigo版本(v3.7),Maven 3.04,和M2E插件。从SVN服务器上检下来正在开发的项目,出现了红叉,pom.xml报错如下错误:maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e。在网上搜索了解决办法,大部分人提出在pom.xml里更添加maven-dependency-plugin配置。但未装机之前为什么就可以呢?所以问题应该聚焦在开发环境上,而且可以肯定是m2e插件没有装对。
事实正如笔者所料,m2e插件从sonatype官方正式迁往eclipse社区,但在官网也不断升级,事实上eclipse社区里下载的较旧版本的。看m2e两个安装地址:
http://download.eclipse.org/technology/m2e/releases/
http://m2eclipse.sonatype.org/sites/m2e
前者是eclipse社区的,后者是官网的,至笔者解决错误时,版本有差距。恰恰我使用了前者,卸载后换上后者最新版就好了。
方案2:
采用忽略的方式,增加<ignore/>
tml] view plaincopyprint?
- <build>
- <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-dependency-plugin</artifactId>
- <versionRange>[2.0,)</versionRange>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- <excludeTransitive>false</excludeTransitive>
- <stripVersion>true</stripVersion>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>