springboot打包成可执行jar
所属分类 spring
浏览量 1373
配置 spring-boot-maven-plugin
https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/maven-plugin/usage.html
org.apache.maven.plugins
maven-compiler-plugin
1.8
UTF-8
org.springframework.boot
spring-boot-maven-plugin
true
dyyx.Hello
ZIP
repackage
mvn package
java -jar springbootdemo-1.0.jar
java -jar xxx.jar --spring.profiles.active=dev
maven命令行运行项目
mvn spring-boot:run
mvn spring-boot:run -Dserver.port=8089
Hello.java
import java.util.Date;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
public class Hello{
public static void main(String[] args) {
SpringApplication.run(Hello.class, args);
}
@RequestMapping("/")
public String home() {
return "hello spring boot "+new Date();
}
}
上一篇
下一篇
springboot2微服务实例
springcloud DiscoveryClient使用说明
maven知识点整理
springboot打包排除配置文件
springboot序列化异常FAIL_ON_EMPTY_BEANS处理
springboot应用打成war包