Linux系统中,将web项目部署到tomcat中

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/daoerZ/article/details/85030724

RT

1. 将项目打成war包:执行maven命令 package命令生成的war包
注: eclipse 中使用 maven -install
2.war 包放到Linux环境中 tomcat 目录下的 wapps 下就好
3. 实现tomcat的热部署: 即tomcat(Liunx)在启动状态下也可以实现项目部署,无需重启
修改 tomcatconf/tomcat-users.xml 配置文件。添加用户名、密码、权限。如下

<role rolename="manager-gui" />
<role rolename="manager-script" />
<user username="username" password="password" roles="manager-gui, manager-script"/>

注: 请求地址 http://localhost:8080/manager 输入帐号密码

使用maven的 tomcat 插件实现热部署:
pom中追加 tomcat 插件配置
配置为自己的tomcat信息

<plugins>  
    <plugin>  
        <groupId>org.apache.tomcat.maven</groupId>  
        <artifactId>tomcat7-maven-plugin</artifactId>  
        <version>2.2</version>  
        <configuration>  
            <port>8080</port>  
            <path>/</path>
            <url>http://localhost:8080/manager/text</url><!--url为tomcat访问路径-->  
            <username>username</username>  <!--之前设置的用户名-->
            <password>password</password>  <!--之前设置的密密码-->
        </configuration>  
    </plugin>  
 </plugins> 

Maben build…,第一次部署时Goals中输入:clean tomcat7:deploy

猜你喜欢

转载自blog.csdn.net/daoerZ/article/details/85030724
今日推荐