springboot项目jsp打包war运行步骤

(一)修改代码只需要2步:

(1)主进口类

@SpringBootApplication
@MapperScan("com.wbq.dgshop.dao")
public class DgshopApplication  extends SpringBootServletInitializer {

	public static void main(String[] args) {
		SpringApplication.run(DgshopApplication.class, args);
	}
	@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(DgshopApplication.class);
    }
}

(2)pox.xml文件把jar改成war

(二)打包步骤

(1)eclipse内的项目选中右键--》Run As--》Maven clean

(2)eclipse内的项目选中右键--》Run As--》Maven build

弹出的窗口--》Goals --》输入:clean install,,再选中Skip Tests

如下图:

springboot项目jsp打包war运行步骤_第1张图片

(3)拷贝生成的war包到tomcat运行,OK。

pox.xml文件



	4.0.0

	com.wbq
	dgshop
	0.0.1-release
	war

	dgshop
	web project for dg

	
		org.springframework.boot
		spring-boot-starter-parent
		2.0.3.RELEASE
		 
	

	
		UTF-8
		UTF-8
		1.8
	

	
		
			org.springframework.boot
			spring-boot-starter-web
			
				
					org.springframework.boot
					spring-boot-starter-logging
				
				
					org.hibernate
					hibernate-validator
				
			   
		

	 
		org.springframework.boot
		spring-boot-starter-log4j2
	

		
			org.springframework.boot
			spring-boot-starter-test
			test
		
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
			1.3.2
		
		
			com.alibaba
			druid
			1.1.9
		
		
			com.alibaba
			druid-spring-boot-starter
			1.1.9
		
		
		
			com.github.pagehelper
			pagehelper-spring-boot-starter
			1.2.5
		
		
			mysql
			mysql-connector-java
		
		
			org.springframework.boot
			spring-boot-devtools
			true
		
		
		
		
		    org.springframework.boot
		    spring-boot-starter-data-redis
		
		
            redis.clients
            jedis
        
		
			org.springframework.session
			spring-session-data-redis
		
		
		    com.alibaba
		    fastjson
		    1.2.47
		
		
			org.springframework.boot
			spring-boot-starter-mail
		
		
		    org.apache.httpcomponents
		    httpclient
		
		
		
			org.apache.commons
			commons-lang3
		
		
			org.springframework.boot
			spring-boot-starter-security
		
		
	 
	 	
			org.springframework.boot
			spring-boot-starter-tomcat
			provided
		
		
			javax.servlet
			javax.servlet-api
			provided
		
	 	
        
            javax.servlet
            jstl
        
		
			org.apache.tomcat.embed
			tomcat-embed-jasper
			provided
		
		 
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	




你可能感兴趣的:(springboot)