Plugin org.apache.maven.plugins:maven-resources-plugin:2.6

本文介绍了在使用Maven创建项目时遇到的错误及其解决办法,包括清理本地仓库、配置镜像源、调整maven-war-plugin设置等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

创建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:\taotao\repository\org\apache\maven\plugins清空里面的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:\taotao\repository\org\apache\maven\plugins清空里面的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

 

转载于:https://www.cnblogs.com/moaiwa/p/8143067.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值