1. 程式人生 > >maven 報錯找不到Could not find artifact maven-plugins:maven-cobertura-plugin:plugin:1.3

maven 報錯找不到Could not find artifact maven-plugins:maven-cobertura-plugin:plugin:1.3

Failed to execute goal on project : Could not resolve dependencies for project cs2c.nkscloudweb:nkscloudweb3:war:3.0: The following artifacts could not be resolved: maven-plugins:maven-cobertura-plugin:plugin:1.3, maven-plugins:maven-findbugs-plugin:plugin:1.3.1: Could not find artifact maven-plugins:maven-cobertura-plugin:plugin:1.3 in nexus (http://10.1.81.221:8081/nexus/content/groups/public) -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project nkscloudweb3: Could not resolve dependencies for project cs2c.nkscloudweb:nkscloudweb3:war:3.0: The following artifacts could not be resolved: maven-plugins:maven-cobertura-plugin:plugin:1.3, maven-plugins:maven-findbugs-plugin:plugin:1.3.1: Could not find artifact maven-plugins:maven-cobertura-plugin:plugin:1.3

一直報錯這個,我查了,沒有引用這兩個依賴呀。

之後增加了 mvn compile -X -e 增加了DEBUG資訊,可以查到:

[DEBUG]    dom4j:dom4j:jar:1.6.1:compile
[DEBUG]       xml-apis:xml-apis:jar:1.0.b2:compile
[DEBUG]    org.jdom:jdom:jar:1.1.2:compile
[DEBUG]       jaxen:jaxen:jar:1.1.3:compile
[DEBUG]          jdom:jdom:jar:1.0:compile
[DEBUG]          xerces:xercesImpl:jar:2.6.2:compile
[DEBUG]          xom:xom:jar:1.0:compile
[DEBUG]             xerces:xmlParserAPIs:jar:2.6.2:compile
[DEBUG]             xalan:xalan:jar:2.6.0:compile
[DEBUG]             com.ibm.icu:icu4j:jar:2.6.1:compile
[DEBUG]          maven-plugins:maven-cobertura-plugin:plugin:1.3:compile


[DEBUG]             cobertura:cobertura:jar:1.8:compile
[DEBUG]             oro:oro:jar:2.0.8:compile
[DEBUG]             commons-jelly:commons-jelly-tags-log:jar:1.0:compile
[DEBUG]          maven-plugins:maven-findbugs-plugin:plugin:1.3.1:compile
[DEBUG]             findbugs:bcel:jar:5.1:compile
[DEBUG]             findbugs:coreplugin:jar:1.0.0:compile
[DEBUG]             findbugs:findbugs:jar:1.0.0:compile
原來是dom4j引用的,修改修改它的版本就可以了吧,或者增加類似這樣的說明:

 <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1.3</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-cobertura-plugin</artifactId>
                    <groupId>maven-plugins</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>maven-findbugs-plugin</artifactId>
                    <groupId>maven-plugins</groupId>
                </exclusion>
            </exclusions>
</dependency>