Maven 修改tomcat运行版本和端口,使用Maven发布项目

maven默认是使用tomcat6跑项目的,这段是让maven用tomcat7/8去跑
在pom.xml中添加

 tomcat7


		
		${project.artifactId}
		compile
		
			
			org.apache.tomcat.maven
                        
			tomcat7-maven-plugin	
			2.2
			
                        
			8082		
                        
			UTF-8
			mgr
                        
			/KBase		
			tomcat7	
			
                        //如果需要发布到容器,需要下面配置
						http://10.98.20.80:8080/manager/text
						admin
						admin
			
			
				org.apache.maven.plugins
				maven-surefire-plugin
				
					true
				
			
		
	
运行:tomcat7:run
发布:tomcat7:redeploy

 

tomcat8 

				
					org.apache.tomcat.maven
					tomcat8-maven-plugin
					3.0-r1655215
					
						8080
						UTF-8
						mgr
						
						/xxxxx
						tomcat
                        //如果需要发布到容器,需要下面配置
						http://10.98.20.80:8080/manager/text
						admin
						admin
					
				

运行:tomcat8:run
发布:tomcat8:redeploy

发布的配置

配置tomcat的conf/tomcat-users.xml 中配置一个user








 

tomcat8除了上一步,还需要配置webapps/manager/META-INF/context.xml,允许其他IP访问


  

 

 

你可能感兴趣的:(MAVEN)