【问题标题】:Maven woes: maven-clean-plugin not found in repositoryMaven 问题:在存储库中找不到 maven-clean-plugin
【发布时间】:2011-06-25 06:46:38
【问题描述】:

叹息。

使用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>

【问题讨论】:

    标签: java maven maven-plugin


    【解决方案1】:

    如果你仔细阅读你的错误,你可以在那里找到答案:

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

    您没有对该目录的写入权限(或者运行 maven 进程的用户没有)

    【讨论】:

    • 啊...在同步我的 .m2 文件时,我还复制了我的 settings.xml,它有一个硬编码路径,指向 mac 风格的 /Users 主目录。非常感谢。
    【解决方案2】:

    我也遇到了类似的问题。 但是我发现那是代理设置,是我们内网使用的,我没有在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>
    

    【讨论】:

    • 我有一个代理连接,这对我有用。我将所有不相关的 XML 标记留空。
    【解决方案3】:

    我的猜测是你有一个配置或网络问题阻止了 maven 访问网络。

    【讨论】:

    • 我尝试关闭 iptables,但没有帮助。我可以 'wget' 到 repos,所以它似乎不是一个连接问题。此外,如果我的 .m2 文件是从一台已知工作的机器上同步的,为什么它甚至需要离开现场?
    【解决方案4】:

    我删除了.m2/ 目录树。然后我在我的项目上做了一个mvn clean,它再次下载了所有内容。

    【讨论】:

      【解决方案5】:

      删除.m2 文件夹是一种选择。您还可以将您的 maven 版本更新为 3.x,以便它可以解析您的 maven 插件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-07
        • 1970-01-01
        • 2016-06-05
        • 1970-01-01
        • 1970-01-01
        • 2018-11-22
        相关资源
        最近更新 更多