這是我pom.xml
建築結構:Maven的嘗試部署到本地主機,而不是遠程服務器
<build>
<finalName>cfwd</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<url>http://xx.xxx.xxx.xxx:8080/manager/text</url>
<server>cifServer</server>
<path>/cfwd</path>
<addContextWarDependencies>true</addContextWarDependencies>
<addWarDependenciesInClassloader>true</addWarDependenciesInClassloader>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
其中http://xx.xxx.xxx.xxx:8080
是遠程服務器IP。
當我嘗試通過mvn tomcat:deploy
部署我得到這個錯誤:
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project cfwd: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL:
http://localhost:8080/manager/deploy?path=%2Fcfwd&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 cfwd: Cannot invoke Tomcat manager
它看起來像Maven是試圖將部署到localhost:8080
,而不是遠程服務器IP。任何想法?
+ 1ed,但會標記鄧肯的答案是正確的,因爲它在你之前。乾杯! –