我已经使用maven,tomcat 7.0.42在我的开发机器上配置了一个Web应用程序,在Ubuntu 12.04上使用此构建在我的pom.xml中:
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>true</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://SERVER-IP:8080/manager/html</url>
<server>server001</server>
<path>/FreeRide-Web</path>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
另外,我的settings.xml中有这个:
<servers>
<server>
<id>server001</id>
<username>admin</username>
<password>password</password>
</server>
</severs>
Run Code Online (Sandbox Code Playgroud)
但是,当我运行"mvn tomcat:deploy -e"时,它说:
Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project FreeRide-Web: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://166.78.166.149:8080/manager/html/deploy?path=%2FFreeRide-Web&war= -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project FreeRide-Web: Cannot …Run Code Online (Sandbox Code Playgroud)