在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的pom.xml文件,声明maven-dependency-plugin和maven-cobertura-plugin,并设置相应的执行目标和参数。例如,可以使用`dependency:copy-dependencies`目标来复制项目依赖,或...
maven-dependency-plugin-2.1.jar
maven-dependency-versions-check-plugin-2.0.2-sources.jar
exec-maven-plugin是Maven生态系统中的一个插件,它允许用户在Maven构建过程中执行外部命令或脚本。这使得Maven项目可以集成更多的自定义操作,比如运行特定的脚本、调用系统命令等。本文将详细介绍exec-maven-...
其中包括27个Java源文件、7个Markdown文档、2个JSON文件、1个gitignore文件、1个LICENSE文件、1个NOTICE文件、1个PNG图片文件、1个licenses/LICENSE-living-documentation文件和1个licenses/LICENSE-maven-...
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 使用 tomcat8-maven-plugin 插件 Maven 是一个流行的构建自动化工具,它可以帮助开发者自动完成项目的编译、测试、打包、部署等任务。 Tomcat 是一个流行的 Web 服务器,Maven 提供了一个插件 tomcat8-maven-...
maven-dependency-plugin-2.1.jar maven-dependency-tree-1.0.jar maven-deploy-plugin-2.7.jar maven-deploy-plugin-2.8.1.jar maven-eclipse-plugin-2.9.jar maven-embedder-3.2.1-sources.jar maven-filtering-...
`maven-compiler-plugin-3.8.0-source-release` 是 Maven 生态系统中不可或缺的一部分,它提供了可靠的源代码编译功能,使得开发者能够专注于编写代码,而无需关心构建过程的细节。通过理解 Maven 插件的工作原理和...
maven-deploy-plugin-2.8.2.jar
maven-dependency-tree-1.2.jar
maven-jar-plugin-3.1.1.jar