maven部署tomcat7

一、修改项目pom.xmlweb

在project节点下,添加tomcat-maven-plugin插件信息,配置好tomcat管理账号和密码apache

<plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <server>tomcat7</server>
                    <port>8082</port>
                    <path>/Openoa</path>
                    <url>http://localhost:8082/manager/text</url>
                    <username>tomcat</username>
                    <password>123456</password>
                    <uriEncoding>UTF-8</uriEncoding>
                </configuration>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>tomcat

二、修改(tomcat)server下tomcat-users.xml文件 给tomcat 添加管理员maven

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

三、启动tomcat,发布项目ui

新建maven build 在Goals下输入:tomcat7:deploy -Dmaven.test.skip=trueurl

大意为在tomcat下部署,部署过程当中忽略测试路径插件

Base directory:为项目路径,使用debug或run运行debug

当控制台出现以下字样表示部署成功调试

四、关闭tomcat、使用maven命令运行tomcat

新建maven build 在Goals下输入:tomcat7:run -Dmaven.surefire.debug

大意为 运行tomcat7 启用调试

配置如图

配置好后使用debug运行,这样就可在tomcat中发布并调试web项目了

运行后 如出现以下等字样又无出现运行时异常,表示部署成功了

相关文章
相关标签/搜索