惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
量子位
G
Google Developers Blog
J
Java Code Geeks
N
Netflix TechBlog - Medium
博客园 - 聂微东
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
雷峰网
雷峰网
M
MIT News - Artificial intelligence
T
Tailwind CSS Blog
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss

博客园 - 代码猫

MySQL中两个DateTime字段相减,得到秒,分,天数 mybatis中大于等于小于等于的写法 Spring boot 自定义注解,Java通过反射获取注解,及注解的说明,附源码下载! Spring boot 自定义注解+@Aspect实现切面输出日志,附源码下载! HTML5 Canvas基础教程 SpringBoot+Jpa动态切换多数据源配置及实现 MySQL使用DATE_FORMAT()函数格式化日期 Java List转String数组与String数组转List MySQL使用IF函数来动态执行where条件 JPA忽略实体类某属性,不持久化某字段的解决方法 git 常用命令 Windows系统CMD窗口下,MySQL建库、还原数据库命令操作示例 Java JPA 报java.lang.IllegalArgumentException: Validation failed for query for method public abstract ...异常的一种原因和解决办法 MySQL 5.7 执行SQL报错:1055 - Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 的解决办法 Java8使用实现Runnable接口方式创建新线程的方法 windows查看端口被占用情况 Windows环境下设置Tomcat8以服务的形式运行,不再打开Tomcat窗口 MySql添加字段命令 Java中String、LocalDateTime、LocalDate、Date互转
Spring boot 打成jar包,并运行jar包。
代码猫 · 2020-12-15 · via 博客园 - 代码猫

实现步骤

1. POM文件

添加如下节点:

<groupId>com.springboot</groupId>
<artifactId>training</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>training</name>
<!-- 打包jar包 -->
<packaging>jar</packaging>
<description>Demo project for Spring Boot</description>

还需要一个插件,一般默认是有的,没有就添加一下,如下:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

2. 使用Maven打包

运行jar包

使用cd命令切换到jar包所在的目录,运行下面的命令:

java -jar xxxx-0.0.1-SNAPSHOT.jar