即使在清除了我的 settings.xml 之后,我在尝试使用此快照依赖项时仍然会收到此错误。鉴于依赖性:
<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 中),插件存储库定义:
<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 错误。如果我真的导航到那个 repo,它正在寻找的 jar 不在那里,只有过时的(我不熟悉 Maven 最终如何解析预期的依赖项名称的机制)。
想法?
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 片段:
<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>
插件的SNAPSHOT已经下载成功:
$ 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] ------------------------------------------------------------------------
这很奇怪,因为我看不出有什么不同,但一切都按预期进行。换句话说,我无法复制...
在您的本地存储库中,您是否在 tomcat-maven-plugin 工件的 1.0-SNAPSHOT 目录中有 maven-metadata*.xml
文件?它们与远程服务器上的匹配吗?他们是否正确指定了内部版本号和时间戳?
如果它们在本地不正确,使用 -U
运行 maven 可能会有所帮助。
您还可以检查 mvn help:effective-pom
并查看 Maven 认为 updatePolicy
是什么用于该存储库上的快照。
或者也许只是从本地存储库中删除您的 tomcat-maven-plugin 工件,然后重试。
如果没有任何帮助,请尝试手动安装(从存储库下载插件并使用 mvn install:install-file
mojo)或从 VCS 检查源代码并在本地构建它。但是这些选项只是解决方法,您在某处遇到了问题(您使用的是什么版本的 maven?)。
关于java - Maven 无法下载 tomcat-maven-plugin 快照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2013576/