在Tomcat中部署Maven项目

时间:2013-03-15 00:44:34

标签: maven tomcat pom.xml

当我不想使用tomcat部署我的maven项目时,我遇到了问题。我只得到404。 当我用码头尝试它时它工作正常。

我认为pom.xml存在问题

<?xml version="1.0" encoding="UTF-8"?>
<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>com.shoot.tail</groupId>
<artifactId>shootout</artifactId>
<packaging>war</packaging>
<version>1.2</version>
<name>Shootout</name>

<repositories>
    <repository>
        <id>java.net</id>
        <url>https://maven.java.net/content/repositories/releases</url>
    </repository>
</repositories>

<properties>
    <myfaces.version>2.1.8</myfaces.version>
    <mojarra.version>2.1.11</mojarra.version>
    <jetty.version>8.1.5.v20120716</jetty.version>
    <tomcat.version>7.0.12</tomcat.version>
</properties>

<profiles>
    <profile>
        <id>mojarra</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>com.sun.faces</groupId>
                <artifactId>jsf-api</artifactId>
                <version>${mojarra.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.sun.faces</groupId>
                <artifactId>jsf-impl</artifactId>
                <version>${mojarra.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>jdbc-pool</artifactId>
                <version>${jdbc-pool.version}</version>
                <scope>system</scope>
                <systemPath>${basedir}/../${web.project}/WebContent/WEB-INF/lib/tomcat-jdbc.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>juli</artifactId>
                <version>${tomcat.version}</version>
            </dependency>
        </dependencies>
        <properties>
            <override-web-xml>src/main/jetty/override-mojarra-web.xml</override-web-xml>
        </properties>
    </profile>
    <profile>
        <id>myfaces</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-api</artifactId>
                <version>${myfaces.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-impl</artifactId>
                <version>${myfaces.version}</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>
        <properties>
            <override-web-xml>src/main/jetty/override-myfaces-web.xml</override-web-xml>
        </properties>
    </profile>
</profiles>

<!-- Project dependencies -->
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-servlet_3.0_spec</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>

</dependencies>

<build>
    <finalName>shootout</finalName>
    <defaultGoal>install</defaultGoal>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>${tomcat.version}</version>
            <configuration>
                 <webAppConfig>
                    <contextPath>/${project.artifactId}</contextPath>
                    <overrideDescriptor>${override-web-xml}</overrideDescriptor>
                </webAppConfig>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <webAppConfig>
                    <contextPath>/${project.artifactId}</contextPath>
                    <overrideDescriptor>${override-web-xml}</overrideDescriptor>
                </webAppConfig>
            </configuration>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <wtpversion>2.0</wtpversion>
                    <downloadSources>true</downloadSources>
                    <additionalProjectFacets>
                        <jst.jsf>2.0</jst.jsf>
                    </additionalProjectFacets>
                </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <version>2.1</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
</project>

版 Eclipse:朱诺 Tomcat:7.0.12 Maven:3.0.5

错误:

    [ERROR] Plugin org.codehaus.mojo:tomcat-maven-plugin:7.0.12 or one of its depend
encies could not be resolved: Failed to read artifact descriptor for org.codehau
s.mojo:tomcat-maven-plugin:jar:7.0.12: Failure to find org.codehaus.mojo:tomcat-
maven-plugin:pom:7.0.12 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 -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:tomc
at-maven-plugin:7.0.12 or one of its dependencies could not be resolved: Failed
to read artifact descriptor for org.codehaus.mojo:tomcat-maven-plugin:jar:7.0.12

        at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re
solve(DefaultPluginDependenciesResolver.java:129)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginD
escriptor(DefaultMavenPluginManager.java:142)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDes
criptor(DefaultMavenPluginManager.java:261)
        at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(D
efaultBuildPluginManager.java:185)
        at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDesc
riptor(MojoDescriptorCreator.java:235)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalcul
ator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalcul
ator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:86)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:98)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to
 read artifact descriptor for org.codehaus.mojo:tomcat-maven-plugin:jar:7.0.12
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.
loadPom(DefaultArtifactDescriptorReader.java:296)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.
readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifac
tDescriptor(DefaultRepositorySystem.java:279)
        at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re
solve(DefaultPluginDependenciesResolver.java:115)
        ... 20 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure t
o find org.codehaus.mojo:tomcat-maven-plugin:pom:7.0.12 in http://repo.maven.apa
che.org/maven2 was cached in the local repository, resolution will not be reatte
mpted until the update interval of central has elapsed or updates are forced
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def
aultArtifactResolver.java:538)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
facts(DefaultArtifactResolver.java:216)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
fact(DefaultArtifactResolver.java:193)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.
loadPom(DefaultArtifactDescriptorReader.java:281)
        ... 23 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to fi
nd org.codehaus.mojo:tomcat-maven-plugin:pom:7.0.12 in http://repo.maven.apache.
org/maven2 was cached in the local repository, resolution will not be reattempte
d until the update interval of central has elapsed or updates are forced
        at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.newExcept
ion(DefaultUpdateCheckManager.java:230)
        at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArti
fact(DefaultUpdateCheckManager.java:204)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def
aultArtifactResolver.java:427)
        ... 26 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

非常感谢你的帮助。 最好的祝愿 罗伯特

4 个答案:

答案 0 :(得分:4)

解决。

这是我最后的pom.xml:

[...]
     <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>tomcat-maven-plugin</artifactId>
      <configuration>
         <server>tomcat</server>  
         <url>http://localhost:8080/manager/text</url>  
      </configuration>
     </plugin>
[...]

感谢guido的帮助(:

答案 1 :(得分:2)

这有效:

https://stackoverflow.com/a/16592276/503601

插件中有一个错误。这个插件没有读取标签网址。

<configuration>
    <url>http://localhost:8080/manager/html</url>
</configuration>

设置属性使用

<properties>
   <maven.tomcat.url>http://localhost:8080/manager/text</maven.tomcat.url>
</properties>

http://jvm-java.blogspot.com.es/2013/06/publish-with-maven-in-tomcat7.html

中的完整文章

答案 2 :(得分:1)

您正在指定tomcat版本而不是tomcat-maven-plugin版本,导致maven无法找到插件(实际上阅读错误消息应该对您有所帮助);这里:

<properties>
    <tomcat.version>7.0.12</tomcat.version>
</properties>
[...]
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>${tomcat.version}</version>
            [...]

对于$ {tomcat.version}使用1.2-SNAPSHOT(例如)或者如果在别处使用tomcat版本则声明另一个变量。

另外,tomcat 7.0需要additional configuration才能与管理器webapp进行交互,如下所示:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <version>1.2-SNAPSHOT</version>
  <configuration>
    <url>http://localhost:8080/manager/html</url>
  </configuration>
</plugin>

或者,您可以使用在apache下已经moved的版本2.x,并且mojos已经被重命名为具有相同目标的tomcat6和tomcat7。

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat6-maven-plugin</artifactId>
      <version>2.1</version>
    </plugin>
    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.1</version>
    </plugin>
  </plugins>
</pluginManagement>

答案 3 :(得分:1)

是的,看起来更好。

我认为它尝试部署项目,但会导致构建失败。

[INFO] Error stacktraces are turned on.
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'id' (position: START_TAG seen ...<servers>\n  \t<id
>... @112:8)  @ C:\Software\maven\conf\settings.xml, line 112, column 8
[WARNING]
[INFO] Scanning for projects...
[WARNING] The POM for org.codehaus.mojo:tomcat7-maven-plugin:jar:2.0-SNAPSHOT is
 missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:tomcat7-mav
en-plugin:2.0-SNAPSHOT: Plugin org.codehaus.mojo:tomcat7-maven-plugin:2.0-SNAPSH
OT or one of its dependencies could not be resolved: Failed to read artifact des
criptor for org.codehaus.mojo:tomcat7-maven-plugin:jar:2.0-SNAPSHOT
Downloading: http://repository.apache.org/content/groups/snapshots-group/org/apa
che/maven/plugins/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xm
l from/to apache.snapshots (http://repository.apache.org/content/groups/snapshot
s-group/): Failed to transfer file: http://repository.apache.org/content/groups/
snapshots-group/org/apache/maven/plugins/maven-metadata.xml. Return code is: 500
 , ReasonPhrase:Server Error.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Shootout 1.2
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.codehaus.mojo:tomcat7-maven-plugin:jar:2.0-SNAPSHOT is
 missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:tomcat7-mav
en-plugin:2.0-SNAPSHOT: Plugin org.codehaus.mojo:tomcat7-maven-plugin:2.0-SNAPSH
OT or one of its dependencies could not be resolved: Failed to read artifact des
criptor for org.codehaus.mojo:tomcat7-maven-plugin:jar:2.0-SNAPSHOT
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from h
ttp://repository.apache.org/content/groups/snapshots-group/ was cached in the lo
cal repository, resolution will not be reattempted until the update interval of
apache.snapshots has elapsed or updates are forced. Original error: Could not tr
ansfer metadata org.apache.maven.plugins/maven-metadata.xml from/to apache.snaps
hots (http://repository.apache.org/content/groups/snapshots-group/): Failed to t
ransfer file: http://repository.apache.org/content/groups/snapshots-group/org/ap
ache/maven/plugins/maven-metadata.xml. Return code is: 500 , ReasonPhrase:Server
 Error.
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:deploy (default-cli) @ shootout >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ shootout -
--
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ shootout ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ sh
ootout ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ shoot
out ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ shootout ---
[INFO] Surefire report directory: C:\Software\workspace\shootout\target\suref
ire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ shootout ---
[INFO] Packaging webapp
[INFO] Assembling webapp [shootout] in [C:\Software\workspace\shootout\target
\shootout]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Software\workspace\shootout\src\main\weba
pp]
[INFO] Webapp assembled in [47 msecs]
[INFO] Building war: C:\Software\workspace\shootout\target\shootout.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ig
nored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specifi
ed as 'true')
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) @ shootout <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) @ shootout ---
[INFO] Deploying war to http://localhost:8080/shootout
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.682s
[INFO] Finished at: Fri Mar 15 10:21:19 CET 2013
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy
(default-cli) on project shootout: Cannot invoke Tomcat manager: Connection refu
sed: connect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project shootou
t: Cannot invoke Tomcat manager
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat
manager
        at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalin
aMojo.java:149)
        at org.codehaus.mojo.tomcat.AbstractWarCatalinaMojo.execute(AbstractWarC
atalinaMojo.java:70)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        ... 19 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketI
mpl.java:69)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja
va:339)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket
Impl.java:200)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:182)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:203)
        at sun.net.www.http.HttpClient.New(HttpClient.java:290)
        at sun.net.www.http.HttpClient.New(HttpClient.java:306)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:995)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:931)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:849)
        at org.codehaus.mojo.tomcat.TomcatManager.invoke(TomcatManager.java:597)

        at org.codehaus.mojo.tomcat.TomcatManager.deployImpl(TomcatManager.java:
662)
        at org.codehaus.mojo.tomcat.TomcatManager.deploy(TomcatManager.java:295)

        at org.codehaus.mojo.tomcat.AbstractDeployWarMojo.deployWar(AbstractDepl
oyWarMojo.java:85)
        at org.codehaus.mojo.tomcat.AbstractDeployMojo.invokeManager(AbstractDep
loyMojo.java:85)
        at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalin
aMojo.java:141)
        ... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

C:\ Software \ maven \ conf \ settings.xml:第111-115行

  <servers>
    <id>tomcat</id>
    <username>admin</username>
    <password>admin</password>
  </servers>

的pom.xml

    <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>
[...]
    <build>
        <finalName>shootout</finalName>
        <defaultGoal>install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <webAppConfig>
                        <contextPath>/${project.artifactId}</contextPath>
                        <overrideDescriptor>${override-web-xml}</overrideDescriptor>
                    </webAppConfig>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0-SNAPSHOT</version>
                <configuration>
                    <url>http://localhost:8080/manager/html</url>
                    <server>tomcat</server>
                    <username>admin</username>
                    <password>admin</password>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                        <wtpversion>2.0</wtpversion>
                        <downloadSources>true</downloadSources>
                        <additionalProjectFacets>
                            <jst.jsf>2.0</jst.jsf>
                        </additionalProjectFacets>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

感谢您的帮助,并对问题数量感到抱歉。 罗伯特