1. 程式人生 > >Plugin org.apache.maven.plugins:maven-resources-plugin:2.6

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

ups require ilo cycle erro window false ref tran

創建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

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