maven-dependency-plugin问题1

    近日由于开始接触另一个项目A, 项目A在STS上基于maven搭建, 寤不想用STS, 遂将项目导入eclipse, 然后报以下错误:
maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.
    故障排查过程:
     1、eclipse已经安装maven插件, 且之前项目无问题
      2、遂怀疑, maven插件可能缺失, 但由于之前项目同样用到此功能, 所以排除
      3、遂在怀疑插件板本问题, 事实正确, 寤eclipse所装m2e插件来自:http://download.eclipse.org/technology/m2e/releases/, 此版本来自maven社区, 过旧,
   解决方案:
     1.换装官网版本:http://m2eclipse.sonatype.org/sites/m2e
     2.在pom文件的< plugins>标签之前添加如下< pluginManagement>标签,此2个标签平级.如下:
    
       <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>     

你可能感兴趣的:(eclipse,maven)