如何设置maven安装插件的位置?

Jon*_*han 2 directory installation plugins maven

我尝试使用maven 2.2.1构建项目并收到以下错误
请注意"无法创建目录" - 我相信D:是一个由TrueCrypt加密的驱动器,现在实际上是H:(D :仍然是无法通过Windows访问的物理驱动器)

如何让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] ------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

Ric*_*ler 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>
  ...
Run Code Online (Sandbox Code Playgroud)