【问题标题】:Maven 3 ignores defined Remote Repository and fails to download snapshot artifactMaven 3 忽略定义的远程存储库并且无法下载快照工件
【发布时间】:2014-05-03 22:02:16
【问题描述】:

我正在尝试使用来自 codehaus 快照存储库的 Groovy 编译器的快照版本,指定为 here - 但似乎无法让 maven 看到存储库中的工件。

我有以下插件配置:

    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher -->
        <version>3.1</version>
        <configuration>
            <compilerId>groovy-eclipse-compiler</compilerId>
            <!-- set verbose to be true if you want lots of uninteresting messages -->
            <!-- <verbose>true</verbose> -->
        </configuration>
        <dependencies>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.9.0-01-SNAPSHOT</version>
            </dependency>

            <!-- for 2.8.0-01 and later you must have an explicit dependency on groovy-eclipse-batch -->
            <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>2.2.1-01-SNAPSHOT</version>

            <!-- or choose a different compiler version -->
            <!-- <version>1.8.6-01</version> -->
            <!-- <version>1.7.10-06</version> -->
        </dependency>
            </dependencies>
    </plugin>

    <plugin>

我的存储库部分显示以下信息:

  <repository>
      <id>Nexus Codehaus</id>
      <url>http://nexus.codehaus.org/snapshots/</url>
      <snapshots>
          <enabled>true</enabled>
      </snapshots>
  </repository>

但是,当我运行 mvn -U clean install 时,我收到以下消息:

[WARNING] The POM for org.codehaus.groovy:groovy-eclipse-compiler:jar:2.9.0-01-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.codehaus.groovy:groovy-eclipse-batch:jar:2.2.1-01-SNAPSHOT is missing, no dependency information available

在构建模块时我还看到以下内容

Downloading: http://repository.apache.org/snapshots/org/codehaus/groovy/groovy-eclipse-compiler/2.9.0-01-SNAPSHOT/maven-metadata.xml

Downloading: http://repository.apache.org/snapshots/org/codehaus/groovy/groovy-eclipse-compiler/2.9.0-01-SNAPSHOT/groovy-eclipse-compiler-2.9.0-01-SNAPSHOT.pom

[WARNING] The POM for org.codehaus.groovy:groovy-eclipse-compiler:jar:2.9.0-01-SNAPSHOT is missing, no dependency information available
Downloading: http://repository.apache.org/snapshots/org/codehaus/groovy/groovy-eclipse-batch/2.2.1-01-SNAPSHOT/maven-metadata.xml

Downloading: http://repository.apache.org/snapshots/org/codehaus/groovy/groovy-eclipse-batch/2.2.1-01-SNAPSHOT/groovy-eclipse-batch-2.2.1-01-SNAPSHOT.pom

[WARNING] The POM for org.codehaus.groovy:groovy-eclipse-batch:jar:2.2.1-01-SNAPSHOT is missing, no dependency information available
Downloading: http://repository.apache.org/snapshots/org/codehaus/groovy/groovy-eclipse-compiler/2.9.0-01-SNAPSHOT/groovy-eclipse-compiler-2.9.0-01-SNAPSHOT.jar
Downloading: http://repository.apache.org/snapshots/org/codehaus/groovy/groovy-eclipse-batch/2.2.1-01-SNAPSHOT/groovy-eclipse-batch-2.2.1-01-SNAPSHOT.jar

看来 maven 正在尝试从我什至没有定义的存储库中下载工件!为什么会出现这种情况?

如果我浏览存储库,我可以看到一个 POM 以及各种快照 jar,所以我看不出这不起作用的原因。我的存储库声明中是否缺少某些内容?

【问题讨论】:

    标签: maven groovy repository pom.xml artifact


    【解决方案1】:

    显然,当您想从远程存储库下载 maven 插件时 - 与标准工件相反,您必须在 pom 中定义一个特殊的 pluginRepositories 部分;一个普通的存储库声明将被忽略。

      <pluginRepositories>
            <pluginRepository>
                <id>Nexus Codehaus</id>
                <url>http://nexus.codehaus.org/snapshots/</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    

    【讨论】:

      猜你喜欢
      • 2014-04-13
      • 2011-07-16
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 2018-04-08
      • 2010-12-13
      • 2015-11-29
      • 1970-01-01
      相关资源
      最近更新 更多