Maven Tomcat插件更改端口 [英] Maven Tomcat Plugin Change Port

查看:150
本文介绍了Maven Tomcat插件更改端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个Spring MVC应用程序,并使用Maven Tomcat插件进行部署. 您如何更改上下文路径和端口? 这是我放置在pom.xml中的Maven插件:

I am trying to create a Spring MVC application and is deploying it with Maven Tomcat Plugin. How do you change the context-path and port? Here is the maven plugin I placed in my pom.xml:

        plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <server>localtomcat</server>
                <port>8081</port>
                <path>/test</path>
                <update>true</update>
                <username>admin</username>
                <password>admin</password>
            </configuration>
        </plugin>

我无法使用上面的路径和端口访问我的网站.但是我可以通过使用旧的context-path和8080来做到这一点.

I can't access my site with the path and port above. But I am able to do so by using the old context-path and 8080.

推荐答案

尝试在pom.xml中添加属性,例如,如果要更改端口号,请使用以下标记:

Try to add properties in your pom.xml, for example if you want to change the port number use this following tag :

<properties>
    <maven.tomcat.port>8081</maven.tomcat.port>
</properties>

单击此处更多tomcat插件属性.

Click here for more tomcat plugin properties.

这篇关于Maven Tomcat插件更改端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆