在maven的pom配置文件中,有时在eclipse中会出现
maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e. 的编译错误。
例如在如下的一段配置文件中(用于复制文件的plugin),在execution中就会出现该错误:
<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}/package</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin>
解决方法:
在已有的<plugins> ... </plugins>前面加上另一个plugins的配置:
<pluginManagement> <plugins> <!-- Ignore/Execute plugin execution --> <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>[1.0.0,)</versionRange> <goals> <goal>copy-dependencies</goal> <goal>unpack</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement>
编译后即可发现error被清除了。
附:用maven复制资源:
<plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>test</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <delete file="${project.build.outputDirectory}/cms_core_config.properties"/> <copy file="src/main/resources/${config.lookup.name}" tofile="${project.build.outputDirectory}/cms_core_config.properties"/> <delete dir="${project.build.outputDirectory}/source"/> <copy todir="${project.build.outputDirectory}/source"> <fileset dir= "src/main/resources/${source.lookup.name}"/> </copy> <!-- Hack to prevent PROD configs getting load to QA --> <delete dir="${project.build.outputDirectory}/prod/source"/> <delete file="${project.build.outputDirectory}/cms_core_messaging_config.properties"/> <copy file="src/main/resources/${messageconfig.lookup.name}" tofile="${project.build.outputDirectory}/cms_core_messaging_config.properties"/> <!-- <delete file="${project.build.outputDirectory}/cms_platform_log4j.xml"/> <copy file="src/main/resources/${log4jconfig.lookup.name}" tofile="${project.build.outputDirectory}/cms_platform_log4j.xml"/> --> <!-- <delete file="${project.build.outputDirectory}/configDebug.txt"/> <copy file="src/main/resources/${calconfig.lookup.name}" tofile="${project.build.outputDirectory}/configDebug.txt"/> <delete file="${project.build.outputDirectory}/jodb-service.xml"/> <copy file="src/main/resources/${jodbconfig.lookup.name}" tofile="${project.build.outputDirectory}/jodb-service.xml"/> --> <delete file="${project.build.outputDirectory}/cms_core_cmsws_config.properties"/> <copy file="src/main/resources/${cmswsconfig.lookup.name}" tofile="${project.build.outputDirectory}/cms_core_cmsws_config.properties"/> </tasks> </configuration> </execution> </executions> </plugin>
相关推荐
maven-dependency-plugin-2.8.jar
maven-dependency-plugin-2.1.jar
maven-dependency-versions-check-plugin-2.0.2-sources.jar
maven-dependencygraph-plugin-0.0.4.jar
maven-dependencygraph-plugin-0.0.3.jar
maven-dependencygraph-plugin-0.0.2.jar
maven-dependencygraph-plugin-0.0.1.jar
maven-dependencygraph-plugin-0.0.4-sources.jar
maven-dependencygraph-plugin-0.0.3-sources.jar
maven-dependencygraph-plugin-0.0.2-sources.jar
maven-dependencygraph-plugin-0.0.1-sources.jar
maven-dependency-tree-1.2.jar
maven-dependency-tree-parser-1.0.6.jar,用于mvn depenency:tree的记录解析
maven-deploy-plugin-2.8.2.jar
maven-jar-plugin-3.1.1.jar
maven-antrun-plugin-3.0.0.jar
maven是个项目管理工具,如果我们不告诉它我们的代码要使用什么样的jdk版本编译的话,它就会用maven-compiler-plugin默认的jdk版本来进行处理,这样就容易出现版本不匹配,以至于可能导致编译不通过的问题。...
maven-dependency-plugin-2.0.jar
maven-resources-plugin-2.4.1.jar
maven-clean-plugin-3.1.0.jar