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

发布于 2024-11-09 05:30:28 字数 3684 浏览 0 评论 0原文

我尝试使用 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] ------------------------------------------------------------------------

I've tried building a project with maven 2.2.1 and received the following error
Notice the "directory cannot be created" - the reason I believe is that D: is a drive that was encrypted by TrueCrypt and is now actually H: (D: remains as a physical drive not accessible through Windows)

How do I make maven try to install the plugin on H: instead of on 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] ------------------------------------------------------------------------

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清秋悲枫 2024-11-16 05:30:28

您可以通过修改全局设置文件(位于 \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>
  ...

You can set the location of your local repository to a different folder by modifying the global settings file (located in \conf\settings.xml). Any plugins and artifacts would then be installed/downloaded to that location.

The following snippet would set the local repository to h:\Maven\repository for example:

<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>
  ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文