Search code examples
gradlespring-bootgradlewgradle-shadow-plugin

Spring-boot Gradle shadow jar plugin | missing EmbeddedServletContainerFactory


I setup up a simple web project in spring boot with only the compile("org.springframework.boot:spring-boot-starter-web") dependency . When I used gradlew bootRun, the application starts up and I am able to get the webpage. If a fat jar is created either manually or through shadow plugin, the jar file refuses to start citing EmbeddedServletContainerFactory missing. Am I missing some other dependencies. The jar task is modified as

jar {
    from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
}

Solution

  • In order for the Spring Boot to create the uber-jar (containing the embedded servlet container), you need to run gradle build.