Maven is failing to download the tomcat-maven-plugin snapshot
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>
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>
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).
Ideas?
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] ------------开发者_StackOverflow中文版------------------------------------------------------------
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...
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?
If they are incorrect locally, running maven with -U
might help.
You might also check mvn help:effective-pom
and see what Maven thinks the updatePolicy
is for snapshots on that repository.
Or maybe just delete your tomcat-maven-plugin artifact from your local repository and try again.
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?).
I know this post is a little old, but the tomcat maven plugin has been moved to the apache maven repository. Codehaus only hosts version 1.0 of the plugin. If you want 2.0-snapshot (so you can run tomcat 7), you need to change your pom.xml a little bit. Note that 2.0 is under development.
<repositories>
...
<repository>
<id>people.apache.snapshots</id>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
And your plugin configuration goes like this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>
Not sure exactly, but looks like they might be using some form of the "buildnumber" maven plugin to include version control revision numbers.
Take a look at http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/maven-metadata.xml and you'll notice that in addition to the normal stuff, theres a xml tag for buildnumber and timestamp.
This may not be ideal, but you might be able to replace:
<version>1.0-SNAPSHOT</version>
with:
<version>1.0-20091222.232027-11</version>
To at least get up and running with the latest version of the plugin.
First off let me say that you do not download the TomCat-Maven-Plugin for Eclipse like other Eclipse plugins.
You simply use the maven tools in Eclipse, to insert the correct maven plugin build commands into your maven pom.xml file.....
If anyone is having trouble understanding how to get their Maven project to run as a maven Build configuration, there are a couple of things you may need to look for:
I would like to upload an image but oh well....
In your Eclipse Web App, hopefully you have a Maven POM.xml file, if not you need to set that up first.
Then, you can right click on it and then find Maven in your menu, then the sub menu item comes up, with a choice called Add Plugin.
There is a field called "Enter groupId, artifactId or sha1, etc.... Type in the word Tomcat there.
It will then load search results in the box below.
Basically what this does is load details in your pom.xml as to which plugins to download when building with Maven.
After that you need to do the Maven build.
Then, you want to go to Run Configurations and make sure you have the correct path to where your webapp lives.
Also in that page, under goals type TomCat:run Then apply Finally run.
If all goes well you will have a Tomcat server running the web app. Then you can go to a browser and enter [http://localhost:8080/webappname/defaultpagename]
and walla!
精彩评论