Maven在导入其他项目时报错:Plugin execution not covered by lifecycle configuration
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven在导入其他项目时报错:Plugin execution not covered by lifecycle configuration相关的知识,希望对你有一定的参考价值。
这几天想把Spring 攻略第二版完整的学习下,所以就在网上下载了该教材的源码,寻思边看书边练习!之前有过一些Maven开发的相关经验,觉得Maven在引入jar包上的配置还是很方便的,所以这次源码的Maven配置我倒是不担心,没想到项目导入后就报了一堆错误,一个一个的去解决,很多问题网上都有解决办法,就剩下一个问题折腾好久才解决掉,现将问题的解决过程记录如下:
1 问题描述
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.0:copy-dependencies (execution: copy-dependencies, phase: process-sources)
2 解决过程
在谷歌上面搜索——org.apache.maven.plugins:maven-dependency-plugin:2.0:copy-dependencies
点击进入链接http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html
将上述代码copy到项目的pom.xml文件中即可,代码如下:
Copying project dependencies
Project dependencies are the dependencies declared in your pom. To copy them with their transitive dependencies, use the dependency:copy-dependencies mojo and configure the plugin like the sample below:
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.10</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project>
粘贴完代码之后,选择Maven——Update Project...
3 Missing artifact javax.transaction:jta:jar:1.0.1B解决办法
就是本地maven库中缺少了这个jar,需要把这个jar安装到本地库中去。
3.1 下载包含此jar的zip包,地址:
http://download.csdn.net/detail/spring123tt/6847843
3.2 cmd到zip包的目录,运行下面的字符串
mvn install:install-file -Dfile=./jta-1_0_1B-classes.zip -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar
上述命令是把下载的jar包安装在本地仓库。
然后去update你的maven工程。就OK了!
4 在sts中导入旧的工程报错处理
报错如图:
一共两个问题,上面已经说明了解决过程。总的来说,需要在工程中引入两个插件,在pom.xml中添加如下代码:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.5</version> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.10</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin> </plugins> </build>
以上是关于Maven在导入其他项目时报错:Plugin execution not covered by lifecycle configuration的主要内容,如果未能解决你的问题,请参考以下文章
使用maven-shade-plugin打包maven项目,项目使用spring框架,打包成jar时报错,跪求大佬,弄了好久没出?
eclipse导入maven项目时报Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources(示例