Maven 3忽略已定义的远程存储库,无法下载快照工件

时间:2014-05-03 22:02:16

标签: maven groovy repository pom.xml artifact

我正在尝试使用codehaus快照存储库中指定的here的Groovy编译器的快照版本 - 但似乎无法使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,所以我看不出为什么这不起作用。我在我的存储库声明中遗漏了什么吗?

1 个答案:

答案 0 :(得分:5)

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

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