By default, Spring Boot repackages your JAR into an executable JAR, and it does that by putting all of your classes inside BOOT-INF/classes
, and all of the dependent libraries inside BOOT-INF/lib
. The consequence of creating this fat JAR is that you can no longer use it as a dependency for other projects.
From Custom repackage classifier:
By default, the
repackage
goal will replace the original artifact with the repackaged one. That's a sane behaviour for modules that represent an app but if your module is used as a dependency of another module, you need to provide a classifier for the repackaged one.The reason for that is that application classes are packaged in
BOOT-INF/classes
so that the dependent module cannot load a repackaged jar's classes.
If you want to keep the original main artifact in order to use it as a dependency, you can add a classifier
in the repackage
goal configuration:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.1.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
With this configuration, the Spring Boot Maven Plugin will create 2 JARs: the main one will be the same as a usual Maven project, while the second one will have the classifier appended and be the executable JAR.
相关推荐
SpringBoot 集成ElasticSearch两个依赖的jar下载,大家可以看一下,我的项目启动了,不懂加Q 243517277,请注明来源
SSO是公司一个已经存在了若干年的项目,后端采用SpringMVC、...编码简单,SpringBoot只需要在pom文件中添加一个starter-web依赖,即可帮助开发者快速启动一个web容器,非常方便。配置简单,SpringBoot可以通过简单
这是一个springboot+maven写的demo,主要演示springboot项目通过maven插件,将依赖与配置文件打包到jar包外部,实现灵活的项目管理.仅供参考学习
电脑暂时没有装maven,最近突发奇想,向在搭建一个spring boot非maven项目,折腾了两个小时,下载jar包冲突问题居多,最后结合网上博客,整理了一份spring boot所需的jar包,亲测没有问题
主要介绍了SpringBoot项目没有把依赖的jar包一起打包的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
主要介绍了项目依赖Springboot jar失败解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
scala程序依赖jar,编写scala必须依赖的jar,否则编译不通过
拥有全套的spring,jdbc,poi,upload功能的jar包。同时已经用在了实际的项目中,解决了需要依赖不完全的问题。
这是一个将spingboot项目打包的jar通过windows服务管理的项目 目录说明: config: 可放置外部yml等配置文件 firmware: 放置jar包,目前只支持一个jar包 jdk*: 放置jar依赖的java库 BatServices.exe: 64位程序,使用...
java(ssm、springboot)项目整合润乾报表常用的jar包。
springboot集成activeMQ,包含了点对点模式,发布/订阅模式。定点投送消息。
新建一个test的数据库即可,表在springboot启动后自动新建 依赖包文件(可选) Maven管理jar包依赖,编译工程自动下载 链接:https://pan.baidu.com/s/1QYVjX-0FeWquWz9zY87oVQ?pwd=ilah 提取码:ilah
一步步教你如何通过将固定依赖jar包拆分出来,每次只更新代码部分,达到300K。 一张图,讲述原理,一步步命令,如何操作,保证按此步骤一步步执行,就可以正常运行,简单清晰,包含打包、运行,一共5步!对新手友好...
此仓库,是我在增加做过一个大型OTO项目,所采用的依赖,包涵了SSM框架相关jar包.-解压后约1个G。
但由于主要使用springboot做为kotlin的依赖注入优先考虑使用相同技术栈,目前ktor也是能对接Shiro做权限管理的,数据库访问层使用MybatisPlus目测也能达到主流开发框架之一,同样的使用kotlin可以简化一些代码。
springBoot 所有依赖的jar包,不需要通过创建maven项目来实现
方法四: 使用命令运行jar或war,因为也是一个传统JavaWeb项目,前后端不分离,打成jar会无法访问静态资源,所以只能打成war,把WEN-INF下面的东西也打包好) java -jar xxx.war 具体可以自行百度搜索Spring Boot项目的...
简单的springboot的学习项目实例,使用了hibernate连接mysql数据库,进行简单的插入和查询操作,项目中已经包含依赖的jar包和数据库脚本,只需要创建配置的数据库并使用数据库脚本建立表即可。
主要介绍了springboot项目打成jar包后无法获取static下的静态资源文件的问题分析,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
SpringBoot就是为了解决Spring缺点而生的,...自动配置就是SpringBoot在底层给我们自动做了一些配置,所以springboot项目不编写配置文件也可以正常运行,但是根据我们的具体开发需要修改SpringBoot自动配置的默认值;