MAVEN_HOME
E:\JDK\mave\apache-maven-3.8.4
在Path写入%MAVEN_HOME%\bin
生成的文件在target
命令为:
java -jar F:\新建文件夹\HQYJ-git\learning-spring-boot\sprtingboot\target\sprtingboot-0.0.1-SNAPSHOT.jar
Pom 引入 spring-boot-starter-tomcat,设置 scope 为 provided,只在编译和测试阶段起作用,打包时候做了 Exclude 操作,使用外置 Tomcat 相关 Jar;
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-tomcatartifactId>
<scope>providedscope>
dependency>
package com.feiyu.sprtingboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
// return super.configure(builder);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}