2014-08-28 20 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>