1

我正在寻找将我的项目打包到没有弹簧启动的 JAR 中,或者在导入时如何访问该 JAR 中的类?

4

1 回答 1

0

Figured it out, at least in Gradle you need to add the tasks below. "springBoot" may be optional but didn't test without but it depends on your need. In other versions of the plug-in (spring-boot-dependencies) you may see "springBoot" task as "bootRepackage" and the jar task would be "enabled=false" in "bootRepackage". Gradle help and this. For Maven you could reference this.

 springBoot  {
     mainClassName  = 'myPackage.App'
 }

 jar {
     enabled = true
 }
于 2020-05-03T06:03:59.373 回答