2011-02-11 65 views
6

感嘆。Maven的困境:未在版本庫中找到maven-clean-plugin

使用maven 2.2.1,突然它不能解決maven-clean-plugin。真的,構建工具需要一個「乾淨」的插件有多瘋狂?

我試着從另一臺機器同步我的.m2目錄,工作得很好,我得到了相同的結果。

taproot:~/$ mvn clean package -DskipTests 
[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building CRM Webapp 
[INFO] task-segment: [clean, package] 
[INFO] ------------------------------------------------------------------------ 
Downloading: http://download.java.net/maven/2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' in repository maven.java.net (http://download.java.net/maven/2) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom 
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Specified destination directory cannot be created: /Users/armhold/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.2 
Downloading: http://repository.jboss.org/nexus/content/groups/public-jboss//org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' in repository public jboss (http://repository.jboss.org/nexus/content/groups/public-jboss/) 
Downloading: https://repository.jboss.org/nexus/content/repositories/releases//org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' in repository jboss-my-rel (https://repository.jboss.org/nexus/content/repositories/releases/) 
Downloading: http://repository.jboss.org/maven2//org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom 
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository JBOSS (http://repository.jboss.org/maven2/): Specified destination directory cannot be created: /Users/armhold/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.2 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom 
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Specified destination directory cannot be created: /Users/armhold/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.2 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Error building POM (may not be this project's POM). 


Project ID: org.apache.maven.plugins:maven-clean-plugin 

Reason: POM 'org.apache.maven.plugins:maven-clean-plugin' not found in repository: Unable to download the artifact from any repository 

    org.apache.maven.plugins:maven-clean-plugin:pom:2.2 

from the specified remote repositories: 
    jboss-my-rel (https://repository.jboss.org/nexus/content/repositories/releases/), 
    central (http://repo1.maven.org/maven2), 
    maven.java.net (http://download.java.net/maven/2), 
    JBOSS (http://repository.jboss.org/maven2/), 
    public jboss (http://repository.jboss.org/nexus/content/groups/public-jboss/) 

for project org.apache.maven.plugins:maven-clean-plugin 

我POM看起來是這樣的:

<repositories> 
    <repository> 
     <id>public jboss</id> 
     <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url> 
    </repository> 

    <repository> 
     <id>jboss-my-rel</id> 
     <url>https://repository.jboss.org/nexus/content/repositories/releases/</url> 
    </repository> 

    <repository> 
     <id>JBOSS</id> 
     <name>JBoss Repository</name> 
     <url>http://repository.jboss.org/maven2/</url> 
    </repository> 

</repositories> 

<pluginRepositories> 
    <pluginRepository> 
     <id>maven.java.net</id> 
     <name>Java.net Maven2 Repository</name> 
     <url>http://download.java.net/maven/2</url> 
    </pluginRepository> 
</pluginRepositories> 

回答

16

,如果你仔細看你的錯誤,你可以找到答案:

Specified destination directory cannot be created: 
/Users/armhold/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.2 

你沒有該目錄的寫權限(或用戶運行Maven過程中沒有)

+0

Ahh ...在同步我的.m2文件時,我還複製了我的settings.xml文件,該文件具有到mac-style/Users主目錄的硬編碼路徑。非常感謝。 – 2011-02-11 01:35:51

2

我的猜測是,你有從獲得的淨停止Maven的一個配置或網絡問題。

+0

我試過把iptables關閉了,這並沒有幫助。我可以'回憶'回購,所以它不會成爲連接問題。另外,如果我的.m2是從已知工作的機器同步的,爲什麼它甚至需要離開現場? – 2011-02-11 01:30:34

5

而且我面臨類似的問題。 但我發現這是代理設置,用於我們的Intranet,我沒有放在Setting.xml中。 把它之後,它嘣嘣......

<proxy> 
     <id>ABC</id> 
     <active>true</active> 
     <protocol>http</protocol> 
     <username>USER</username> 
     <password>Password</password> 
     <port>8080</port> 
     <host>XXX.net</host> 
     <nonProxyHosts>local.net,some.host.com</nonProxyHosts> 
    </proxy> 
+0

繁榮熱潮繁榮! – Kayvar 2013-06-05 21:25:26

1

我刪除了.m2/目錄樹。然後我在我的項目上做了一個mvn clean,它再次下載了所有內容。

-3

刪除.m2文件夾是一種選擇。你也可以將你的Maven版本更新到3.x,這樣它可以解決你的Maven插件。