[英]Tomcat 7 maven build failed with Jersey
我正在尝试在eclipe Luna中使用Jersey 2.5设置Maven项目。
这是可能pom.xml
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>MavenTest</groupId>
<artifactId>Jersey Project</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>MC-Server Maven Webapp</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://people.apache.org/repo/m2-snapshot-repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>MavenJerseyTest</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>
</project>
当我建立它
[INFO] Scanning for projects...
[WARNING] The POM for org.apache.tomcat.maven:tomcat7-maven-plugin:jar:7 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat7-maven-plugin:7: Plugin org.apache.tomcat.maven:tomcat7-maven-plugin:7 or one of its dependencies could not be resolved: Failure to find org.apache.tomcat.maven:tomcat7-maven-plugin:jar:7 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO] Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-metadata.xml
[INFO] Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository): connect timed out
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository): connect timed out
[INFO] Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/codehaus/mojo/tomcat-maven-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.codehaus.mojo:tomcat-maven-plugin/maven-metadata.xml from/to apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository): connect timed out
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MC-Server Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.tomcat.maven:tomcat7-maven-plugin:jar:7 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat7-maven-plugin:7: Plugin org.apache.tomcat.maven:tomcat7-maven-plugin:7 or one of its dependencies could not be resolved: Failure to find org.apache.tomcat.maven:tomcat7-maven-plugin:jar:7 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from http://people.apache.org/repo/m2-snapshot-repository was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository): connect timed out
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from http://people.apache.org/repo/m2-snapshot-repository was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository): connect timed out
[WARNING] Failure to transfer org.codehaus.mojo:tomcat-maven-plugin/maven-metadata.xml from http://people.apache.org/repo/m2-snapshot-repository was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo:tomcat-maven-plugin/maven-metadata.xml from/to apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository): connect timed out
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) @ MC-Server >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MC-Server ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is plat
form dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ MC-Server ---
[INFO] No sources to compile
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) @ MC-Server <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ MC-Server ---
[INFO] Running war on http://localhost:8080/MavenJerseyTest
[INFO] Creating Tomcat server configuration at /myprojects/maven/MavenJerseyTest/target/tomcat
这似乎不适用于tomcat 7,但适用于6。
有人让我知道哪里出了问题吗? (这同一个项目的结构可以构建成在Eclipse中noraml web项目和工作过的平静,也有喜欢同样的问题, 这样 ,但我想他们,而不是工作。我改变了Tomcat插件版本为2.1,其建议作为一个答案在另一个问题上,它也不起作用..)
这不是因为泽西岛。 更改tomcat插件的pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
而对于tomcat目标: tomcat7:redeploy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.