简体   繁体   English

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

[英]Maven 3 ignores defined Remote Repository and fails to download snapshot artifact

I am attempting to use a snapshot version of a Groovy compiler from codehaus snapshot repository as specified here -but cannot seem to make maven see the artifact in the repository. 我尝试使用此处指定的来自Codehaus快照存储库的Groovy编译器的快照版本-但似乎无法使Maven看到存储库中的工件。

I have the following plugin configuration: 我有以下插件配置:

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

And my repositories section shows the following information: 我的存储库部分显示以下信息:

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

However, when I run mvn -U clean install I get the following message: 但是,当我运行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

I also see the following when building the modules 构建模块时,我还会看到以下内容

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

It appears maven is trying to download the artifacts from a repository that I have not even defined! 看来maven正在尝试从我什至没有定义的存储库中下载工件! Why would this occur? 为什么会发生这种情况?

If I browse the repository I can see a POM as well as the various snapshot jars, so I can see no reason why this would not work. 如果浏览存储库,我会看到一个POM以及各种快照jar,因此我看不到为什么它不起作用。 Am I missing something in my repository declaration? 我在存储库声明中缺少什么吗?

Apparently when you want to download a maven plugin from a remote repository -as opposed to a standard artifcat, you have to define a special pluginRepositories section in your pom; 显然,当您想从远程存储库下载Maven插件时-与标准artifcat相对,您必须在pom中定义一个特殊的pluginRepositories部分; a plain Repository declaration will just be ignored. 普通的存储库声明将被忽略。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM