Maven无法下载tomcat-maven-plugin快照 [英] Maven is failing to download the tomcat-maven-plugin snapshot

查看:118
本文介绍了Maven无法下载tomcat-maven-plugin快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使清除了settings.xml之后,在尝试使用此快照依赖项时仍然出现此错误.给定依赖性:

Even after wiping out my settings.xml, I still get this error when trying to use this snapshot dependency. Given the dependency:

<plugin>            
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <configuration>                 
        <path>/licensing</path>
        <tomcatWebXml>${basedir}/src/main/mock/web.xml</tomcatWebXml>
    </configuration>
</plugin>

然后(在POM中),插件存储库定义:

And (in the POM), the plugin repository definition:

<pluginRepository>
    <id>Codehaus Snapshots</id>
    <url>http://snapshots.repository.codehaus.org</url>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <releases>
        <enabled>true</enabled>  <!-- Workaround for MNG-2974, see note below -->
    </releases>
</pluginRepository> 

我留下了以下404错误.如果我实际上导航到该存储库,那么它所寻找的jar就不存在了,只是陈旧的(我不熟悉Maven最终解析期望的依赖项名称的机制).

I'm left with the following 404 error. If I actually navigate out to that repo, the jar it's looking for isn't there, just dated ones (I'm not familiar with the mechanics of how Maven ultimately resolves expected dependency names).

想法?


Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-pl
ugin-1.0-SNAPSHOT.jar
[INFO] Unable to find resource 'org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT' in repository Codehaus
Snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to downl
oad the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=tomcat-maven-plugin -Dversion=1.0-SNAPSHOT -Dpacka
ging=maven-plugin -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=tomcat-maven-plugin -Dversion=1.0-SNAPSHOT -Dpackagi
ng=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


  org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  Codehaus Snapshots (http://snapshots.repository.codehaus.org)


  org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  Codehaus Snapshots (http://snapshots.repository.codehaus.org)


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Jan 06 10:06:49 EST 2010
[INFO] Final Memory: 14M/36M
[INFO] ------------------------------------------------------------------------

推荐答案

我重新检查了一下,并带有以下pom片段:

I rechecked and, with the following pom fragments:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  ...
  <pluginRepositories>
    <pluginRepository>
      <id>Codehaus Snapshots</id>
      <url>http://snapshots.repository.codehaus.org/</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>  <!-- Workaround for MNG-2974, see note below -->
      </releases>
    </pluginRepository>
  </pluginRepositories>
  ...
  <build>
    <finalName>my-webapp</finalName>
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
      </plugin>
      ...
    </plugins>
   ...
  </build>
</project>

插件的快照已成功下载:

The SNAPSHOT of the plugin has been downloaded successfully:


$ mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building my-webapp Maven Webapp
[INFO]    task-segment: [clean]
[INFO] ------------------------------------------------------------------------
[INFO] snapshot org.codehaus.mojo:tomcat-maven-plugin:1.0-SNAPSHOT: checking for updates from Codehaus Snapshots
[INFO] snapshot org.codehaus.mojo:tomcat-maven-plugin:1.0-SNAPSHOT: checking for updates from maven2-repository.dev.java.net
Downloading: http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-plugin-1.0-20091222.232027-11.pom
5K downloaded  (tomcat-maven-plugin-1.0-20091222.232027-11.pom)
Downloading: http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-plugin-1.0-20091222.232027-11.jar
48K downloaded  (tomcat-maven-plugin-1.0-20091222.232027-11.jar)
[INFO] [clean:clean {execution: default-clean}]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Wed Jan 06 16:13:28 CET 2010
[INFO] Final Memory: 7M/78M
[INFO] ------------------------------------------------------------------------

这很奇怪,因为我看不到任何区别,但是一切都按预期进行.换句话说,我无法复制...

It's very weird because I can't see any difference, but things are working as expected. In other words, I can't reproduce...

在您的本地存储库中,您的1.0-SNAPSHOT目录中是否有maven-metadata*.xml个文件,用于tomcat-maven-plugin工件?它们与远程服务器上的匹配吗?他们是否正确指定内部版本号和时间戳?

In your local repository, do you have maven-metadata*.xml files in the 1.0-SNAPSHOT directory for the tomcat-maven-plugin artifact? Do they match the ones on the remote server? Do they correctly specify the build number and timestamp?

如果它们在本地不正确,则使用-U运行maven可能会有所帮助.

If they are incorrect locally, running maven with -U might help.

您还可以检查mvn help:effective-pom并查看Maven认为updatePolicy用于该存储库中的快照.

You might also check mvn help:effective-pom and see what Maven thinks the updatePolicy is for snapshots on that repository.

或者也许只是从本地存储库中删除您的tomcat-maven-plugin工件,然后重试.

Or maybe just delete your tomcat-maven-plugin artifact from your local repository and try again.

如果没有帮助,请尝试手动安装(从存储库下载插件并使用mvn install:install-file mojo)或从VCS签出源代码并在本地构建.但是这些选项只是解决方法,您在某个地方遇到了问题(您正在使用哪种版本的Maven?).

If nothing helps, try to install it manually (download the plugin from the repository and use the mvn install:install-file mojo) or checkout the sources from the VCS and build it locally. But these options are just workarounds, you have a problem somewhere (what version of maven are you using?).

这篇关于Maven无法下载tomcat-maven-plugin快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆