2014-08-28 31 views
0

我的應用程序在我的本地運行的URL即http://localhost:8080/WebIntegrationApp代替本地主機。 有什麼辦法來取代http://localhost:8080/WebIntegrationApp網址與http://WebIntegrationApp的pom.xml文件。 我的意思是我想運行這個應用程序使用url http://WebIntegrationApp如何用POM文件意味着全URL名稱

使用的操作系統是Windows7的,下面是用於本地主機運行Tomcat插件:

<plugin> 
    <groupId>org.apache.tomcat.maven</groupId> 
    <artifactId>tomcat7-maven-plugin</artifactId> 
    <version>2.2</version> 
    <configuration> 
     <url>http://localhost:8080/manager/text</url> 
     <server>localhost</server> 
     <path>/WebIntegrationApp</path> 
     <username>admin</username> 
     <password>s3cret</password> 

    </configuration> 
    <executions> 
     <execution> 
      <id>tomcat-run</id> 
      <goals> 
       <goal>run-war-only</goal> 
      </goals> 
      <phase>pre-integration-test</phase> 
      <configuration> 
       <fork>true</fork> 
      </configuration> 
     </execution> 

     <execution> 
      <id>tomcat-shutdown</id> 
      <goals> 
       <goal>shutdown</goal> 
      </goals> 
      <phase>post-integration-test</phase> 
     </execution> 
    </executions> 
</plugin> 

回答

0

是。您可以使用任何文本編輯器編輯的pom.xml

0

如果你想在本地機器上運行的應用程序,你,你應該修改你的hosts文件。然後編輯你的pom.xml

在Windows系統主機位於:WINDOWS \ SYSTEM32 \ drivers \ etc下\ 在Linux上:/ etc/hosts中

+0

感謝您的回答。我想這不是一個好主意。如果這個文件必須由不同的用戶使用,那麼每個人都必須編輯主機文件。所以我正在尋找一個通用的解決方案。一個變化適用於其他人。 – 2014-08-28 12:46:07

+0

然後你應該配置你的DNS服務器設置。 – 2014-08-28 13:00:29

0

這無關與Maven的maven-tomcat-plugin只負責運行配置的Web應用程序。

它將使用附加到端口所提供的服務器(本地主機)(缺省爲)和由所述web應用上下文名稱follwed;你的是WebIntegrationApp

你所想達到可使用前端服務器通過配置一些路由規則,所以當你在瀏覽器中,你會被重定向到http://WebIntegrationApphttp://localhost:8080/WebIntegrationApp完成,如Apache Httpd。 而在幕後,會有一個轉向機構,所以當你打http://WebIntegrationApp;在後臺請求發送到http://localhost:8080/WebIntegrationApp

這將需要一些配置,如果你不使用Apache httpd所馴化。這裏是VirtualHost配置你應該有縮短線:

<VirtualHost *:80> 
    ServerName  Enter your server DNS name here 
    ProxyRequests Off 
    ProxyPreserveHost On 
    ProxyPass "/" http://localhost:8080/ 
    ProxyPassReverse "/" http://localhost:8080/ 
</VirtualHost>