2011-05-21 93 views
2

我試過用maven 2.2.1構建一個項目,並收到以下錯誤
注意「目錄無法創建」 - 我相信的原因是D:是一個被TrueCrypt加密的驅動器,現在實際上是H:(D:仍然是一個物理驅動器,不能通過Windows訪問)如何設置maven安裝插件的位置?

我該如何讓Maven嘗試在H上安裝插件:而不是在D上:?

C:\dev\some-project>mvn -f uberPom.xml install 
[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Declarations 
[INFO] task-segment: [install] 
[INFO] ------------------------------------------------------------------------ 
Downloading: http://download.java.net/maven/2/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7' in repository maven2-repository.dev.java.net (http://download.java.net/maven/2) 
Downloading: http://repo.marketcetera.org/maven/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7' in repository internal (http://repo.marketcetera.org/maven) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.pom 
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7' from repository central (http://repo1.maven.org/maven2): Specified destination directory cannot be created: D:\.m2\repository\org\apache\ 
maven\plugins\maven-site-plugin\2.0-beta-7 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.pom 
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7' from repository central (http://repo1.maven.org/maven2): Specified destination directory cannot be created: D:\.m2\repository\org\apache\ 
maven\plugins\maven-site-plugin\2.0-beta-7 
Downloading: http://download.java.net/maven/2/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7' in repository java.net (http://download.java.net/maven/2) 
Downloading: http://repo.marketcetera.org/maven/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.pom 
[INFO] Unable to find resource 'org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7' in repository internal (http://repo.marketcetera.org/maven) 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Error building POM (may not be this project's POM). 


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

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

    org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7 

from the specified remote repositories: 
    central (http://repo1.maven.org/maven2), 
    java.net (http://download.java.net/maven/2), 
    internal (http://repo.marketcetera.org/maven), 
    maven2-repository.dev.java.net (http://download.java.net/maven/2) 

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


[INFO] ------------------------------------------------------------------------ 
[INFO] For more information, run Maven with the -e switch 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 5 seconds 
[INFO] Finished at: Sat May 21 14:45:51 IDT 2011 
[INFO] Final Memory: 2M/46M 
[INFO] ------------------------------------------------------------------------ 
+0

首先意味着你已經改變了你的settings.xml使用不同的位置你的本地庫(可能是用戶家是基於變化在Windows中我不知道的配置)..此外,爲什麼你使用不同的pom? – khmarbaise 2011-05-21 12:52:35

+0

@khmarbaise - 你是什麼意思的不同pom? – Jonathan 2011-05-21 16:35:26

+0

爲什麼使用mvn -f ueberPom.xml安裝而不是簡單的mvn安裝... – khmarbaise 2011-05-21 17:27:32

回答

5

您可以通過修改全局設置文件(位於\的conf \ settings.xml中)設置你的本地資源庫的位置,以不同的文件夾。任何插件和工件將被安裝/下載到該位置。

下面的代碼片段將本地存儲庫設置爲h:\Maven\repository例如:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
        http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
    <localRepository>h:\Maven\repository</localRepository> 
    ... 
相關問題