2012-12-05 123 views
4

這是我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。任何想法?

回答

6

您需要執行mvn tomcat7:deploy(注意'7')才能觸發您配置的插件。

有關可用目標的更多信息,請參閱this page

1

403表示禁止。

使用official documentation進行檢查,以便爲Tomcat管理器配置身份驗證(參數服務器,密碼,用戶名)。

鄧肯瓊斯是對的:你沒有執行正確的插件:使用tomcat7。

+0

+ 1ed,但會標記鄧肯的答案是正確的,因爲它在你之前。乾杯! –

相關問題