1

I have a spring boot project using Gradle that is Spring Boot 1.5.7, when I build the executable jar the packaged jar file contains all my resources, application classes and manifest information for pointing to the main class. BUT it doesn't seem to include any of the dependencies that I have declared as compiled classes inside the fat jar. I've not had this problem when running Spring Boot 2.x projects.

Here's a simplified version of the build.gradle

apply plugin: 'maven'

buildscript {
    ext {
        springBootVersion = '1.5.7.RELEASE'
    }

    repositories {
        maven {
            url "$ARTIFACTORY_URL/remote"
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }
    }

    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

dependencies {
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    implementation('org.springframework.boot:spring-boot-starter-web')
}

What could be the issue?

PDStat
  • 5,513
  • 10
  • 51
  • 86
  • How did you determine that? What happens when you start your app, using `java -jar yourapp.jar`? What is printed when you execute `jar tvf yourapp.jar`? – JB Nizet Nov 06 '18 at 00:36
  • OK I read that wrong, looks like at least some of the spring boot classes are there (I can see only the org.springframework.boot.loader packages), what I am getting though is NoClassDefFoundError for org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory – PDStat Nov 06 '18 at 00:49
  • 1.5.7 is quite old, and I'm not sure it supports the version of gradle that you're using. I would upgrade. And if not possible, try using compile and testCompile for the configurations, or even go back to the version of gradle that was supported at the time 1.5.7 went out. – JB Nizet Nov 06 '18 at 00:54
  • 1
    Hmmm yeah I'll try upgrading, initially I did need this specific version but I don't think that's the case anymore! BTW love DbSetup ;) – PDStat Nov 06 '18 at 08:11
  • As @JBNizet said you should upgrade SpringBoot verison, to at least 1.5.17 (latest version for 1.5.x branch) . I also recommand you try to generate a simple project with https://start.spring.io/ : use version 1.5.17 with started `web` : you will see that the Gradle wrapper is automatically configured with version 3.5.1 . Which version of Gradle did you use? – M.Ricciuti Nov 06 '18 at 08:22
  • Latest version, problem is this is a subproject where all other subprojects are spring boot 2.x, think I'll go with upgrading spring boot to 2.x – PDStat Nov 06 '18 at 08:24
  • What version of gradle are you using? – Bwvolleyball Nov 13 '19 at 18:29

0 Answers0