zoukankan      html  css  js  c++  java
  • Plugin org.apache.maven.plugins:maven-resources-plugin:2.6

    创建maven project时工程报错
    Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to nexus (http://localhost:8080/nexus-2.7.0-06/content/groups/public/): Connect to localhost:8080 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect -> [Help 1]

    方法一:网上有很多人说以下方法可行

    1.打开maven根目录里的config并打开settings.xml找到本地仓库位置即<localRepository>F:/taotao/repository</localRepository>

    2.打开F: aotao epositoryorgapachemavenplugins清空里面的plugins

    3.右键maven工程->run as->maven install

    方法二:

    1.打开maven根目录里的config并打开settings.xml添加

            <mirror>   
                <id>Central</id>   
                <url>http://repo1.maven.org/maven2</url>   
                <mirrorOf>central</mirrorOf>   
            </mirror> 

    2.打开F: aotao epositoryorgapachemavenplugins清空里面的plugins

    3.右键maven工程->run as->maven install,此时将会下载大部分plugins,但是又出现了以下问题
    Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project itcast-usemanage: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]

    4-1.项目中有web.xml,则在pom.xml的<build>节点上加上maven-war-plugin配置

    <plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-war-plugin</artifactId>  
            <version>3.0.0</version>  
            <configuration>  
                <webResources>  
                    <resource>  
                        <directory>WebContent</directory>  
                    </resource>  
                </webResources>  
            </configuration>  
        </plugin>  
    </plugins> 

    4-2.项目中有web.xml,则在pom.xml的<build>节点上加上maven-war-plugin配置

    <plugins> 
        <plugin> 
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-war-plugin</artifactId> 
            <version>3.0.0</version> 
            <configuration> 
                <failOnMissingWebXml>false</failOnMissingWebXml> 
            </configuration> 
        </plugin> 
    </plugins> 
    5.右键maven工程->run as->maven install,成功解决问题

    方法三:

    1.windows->preferences->maven->lifecycle mapping找到里面的mapping file location

    地址为:D:/itcast-workspace/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml

    当我们打开的时候发现招不到这个路径

    2.打开eclipses的根目录打开plugins找到名为org.eclipse.m2e.lifecyclemapping.defaults_1.5.0.20140606-0033.jar的包

    3.解压步骤2中的jar包至步骤1中的mapping file location并打开lifecycle-mapping-metadata.xml

    4.如缺少maven-compiler-plugin就添加其配置
        <pluginExecution>
          <pluginExecutionFilter>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <versionRange>[2.5.1,)</versionRange>
            <goals>
              <goal>testCompile</goal>
              <goal>compile</goal>
            </goals>
          </pluginExecutionFilter>
          <action>
            <ignore/>
          </action>
        </pluginExecution>

    5.windows->preferences->maven中将update maven projects on startup勾上

    6.右键项目->maven->update projects

    
    
  • 相关阅读:
    Spring9:Autowire(自动装配)机制
    【Spring源码分析】非懒加载的单例Bean初始化前后的一些操作
    记一次synchronized锁字符串引发的坑兼再谈Java字符串
    Cglib及其基本使用
    Java回调机制解读
    【设计模式总结】对常用设计模式的一些思考
    【Spring源码分析】非懒加载的单例Bean初始化过程(下篇)
    【Spring源码分析】非懒加载的单例Bean初始化过程(上篇)
    【Spring源码分析】Bean加载流程概览
    Spring8:一些常用的Spring Bean扩展接口
  • 原文地址:https://www.cnblogs.com/moaiwa/p/8143067.html
Copyright © 2011-2022 走看看