zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    SQL语句获取数据库名、表名、储存过程以及参数列表 狼
    CKEditor3.3+CKFinder2.0附带CKF去除水印 狼
    media player 和realplayer 编程接口 狼
    教您如何去认识人!(识人术) 狼
    引用 JS判断浏览器类型方法 狼
    (转)初始化多维数组
    kmeans 聚类 (代码为: 博客数据聚类) (python )
    对博客订阅源URL中的单词进行计数 (仅限英文博客,中文订阅源不支持 )
    eclipse +python 修改 各种颜色 +字体
    常见错误收集: lucene 读取word文档问题
  • 原文地址:https://www.cnblogs.com/lixuwu/p/5908336.html
Copyright © 2011-2022 走看看