MyEclipse maven 远程 自动 部署项目到tomcat7

1、tomcat文件夹中的tomcat.conf.tomcat-users.xml中配置:

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="xxx" roles="manager-script"/>
<user username="root" password="xxx" roles="manager-gui"/>

2、tomcat文件夹中的tomcat.conf.Catalina/localhost.manager.xml中配置:

<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false"
         docBase="${catalina.home}/webapps/manager">
    <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
</Context>

3、在项目中的pom.xml中加入leak,防止tomcat自动部署时内存溢出

<dependency>
    <groupId>se.jiderhamn.classloader-leak-prevention</groupId>
	<artifactId>classloader-leak-prevention-servlet</artifactId>
	<version>2.1.0</version>
</dependency>

4、在web.xml中加入监听leak,此监听要放在第一个位置

<listener>
	<listener-class>se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventorListener</listener-class>
</listener>

5、在pom.xml中加入编译build,

http://ip:port/manager远程tomcat的管理页面,用之前配置的admin登录

/ROOT,表示项目直接放在根目录,我在上传项目时,一直失败,把之前的ROOT删除后,上传成功。

<build>
	<sourceDirectory>src</sourceDirectory>
	<plugins>
		<plugin>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>2.3.2</version>
			<configuration>
				<source>1.7</source>
				<target>1.7</target>
			</configuration>
		</plugin>
		
		<plugin>
			<artifactId>maven-war-plugin</artifactId>
			<version>2.2</version>
			<configuration>
				<warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
				<version>2.5</version>
			</configuration>
		</plugin>

		<plugin>
			<groupId>org.apache.tomcat.maven</groupId>
			<artifactId>tomcat7-maven-plugin</artifactId>
			<version>2.2</version>

			<configuration>
				<url>http://ip:port/manager/text</url>
				<username>admin</username>
				<password>xxx</password>
				<update>true</update>
				<path>/ROOT</path>
			</configuration>
		</plugin>
	</plugins>
</build>

6、发布:给jdk配maven的参数,maven的home,按图片中给出的配置,最后点run即可远程部署

-Dmaven.multiModuleProjectDirectory=M2_HOME

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值