SpringBoot项目没有把依赖的jar包一起打包的问题解决
作者:smile_lg 时间:2021-08-11 12:15:02
这篇文章主要介绍了SpringBoot项目没有把依赖的jar包一起打包的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
一般未一起打包是因为pom不是继承自spring-boot-starter-parent导致的需要在pom.xml文件写入以下配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.szmirren.Main</mainClass><!-- 你的主类全路径 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
然后再执行:maven install
如果pom继承自spring-boot-starter-parent,打包只需要pom.xml添加如下配置
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
如果要设置编译版本,跳过单元测试再加如下配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests> <!--默认关掉单元测试 -->
</configuration>
</plugin>
来源:https://www.cnblogs.com/lgjava/p/11548764.html
标签:spring,boot,项目,依赖,jar,包,打包
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
.NET程序员如何入门Spring Boot详解
2022-04-18 08:04:05
![](https://img.aspxhome.com/file/2023/6/104066_0s.png)
SpringDataJpa如何使用union多表分页条件查询
2023-05-16 04:28:49
Android Wear计时器开发
2023-04-10 01:22:21
![](https://img.aspxhome.com/file/2023/4/93324_0s.png)
解决java读取EXCEL数据变成科学计数法的问题
2023-06-14 02:17:56
![](https://img.aspxhome.com/file/2023/5/83675_0s.png)
Java实现的zip工具类完整实例
2021-06-22 07:16:17
Java ConcurrentHashMap用法案例详解
2023-08-30 02:01:41
Spring Cloud Eureka(全面解析) 大白话
2022-11-12 22:43:02
![](https://img.aspxhome.com/file/2023/5/62735_0s.png)
剑指Offer之Java算法习题精讲链表专项训练
2023-11-29 16:31:48
![](https://img.aspxhome.com/file/2023/1/60611_0s.png)
Spring整合mybatis实现过程详解
2022-05-23 02:10:23
![](https://img.aspxhome.com/file/2023/5/71605_0s.png)
详解Java编程中protected修饰符与static修饰符的作用
2022-05-11 03:53:17
![](https://img.aspxhome.com/file/2023/9/62959_0s.png)
Java nacos动态配置实现流程详解
2021-06-04 19:18:30
![](https://img.aspxhome.com/file/2023/5/83555_0s.png)
Servlet+JDBC实现登陆功能的小例子(带验证码)
2021-05-29 03:04:25
![](https://img.aspxhome.com/file/2023/7/69897_0s.png)
Java Redis Redisson配置教程详解
2022-10-13 06:32:39
spring-mybatis获取mapper的四种方式汇总
2023-11-23 06:24:39
![](https://img.aspxhome.com/file/2023/3/59743_0s.jpg)
JavaWeb开发之【Tomcat 环境配置】MyEclipse+IDEA配置教程
2022-05-04 12:50:18
![](https://img.aspxhome.com/file/2023/8/85478_0s.png)
详解Android应用中ListView列表选项栏的编写方法
2023-09-03 15:01:25
![](https://img.aspxhome.com/file/2023/4/103904_0s.jpg)
spring boot多数据源动态切换代码实例
2022-03-11 00:37:09
![](https://img.aspxhome.com/file/2023/7/71867_0s.png)
Java数据结构及算法实例:快速计算二进制数中1的个数(Fast Bit Counting)
2022-07-31 14:39:23
Java创建线程的五种写法总结
2023-01-10 04:39:34
Java并发编程之Java内存模型
2023-08-17 23:06:10
![](https://img.aspxhome.com/file/2023/7/91547_0s.png)