对于作为春季启动Web应用程序的sbt项目,我正在使用sbt assembly
创建一个胖jar。运行java -jar foo.jar
java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
使用mvn时有针对此问题的解决方案,但我无法将其应用于sbt项目。以下是build.sbt:
name := "foo"
version := "0.1"
scalaVersion := "2.12.6"
libraryDependencies +=
"org.springframework.boot" % "spring-boot-starter-web" % "2.0.4.RELEASE"
mainClass in assembly := Some("com.foo.Application")
assemblyMergeStrategy in assembly := {
case manifest if manifest.contains("MANIFEST.MF") =>
MergeStrategy.discard
case _ =>
MergeStrategy.first
}