The smoke test jars created by Gradle are no longer fat. This makes it hard to use them for testing.

Comment From: wilkinsona

Sorry. I realised this in the early stage of the migration and then forgot about it.

Unfortunately, it's not easy to fix due to the same sorts of problems that led us to using the Invoker plugin in the Maven build. Specifically, we can't easily use Boot's Gradle plugin. It is possible with a GradleBuild task which is what spring-boot-launch-script-tests does to build a fat jar with the launch script prepended to it.

Comment From: philwebb

Thinking about this some more, it's pretty wastefully to spit out a fat jar for regular builds if we don't need them. I'm not keen to return to a invoker like setup either.

Is there any way to have some kind of opt-in solution where you can build an individual smoke test in a fat mode if you really need it?

Comment From: wilkinsona

You can add a pseudo-bootJar task to any smoke test like this:

configurations {
    loader
}

dependencies {
    loader(project(":spring-boot-project:spring-boot-tools:spring-boot-loader"))
}

jar {
    classifier = 'plain'
}

task bootJar(type: Jar) {
    entryCompression = "stored"
    from {
        zipTree(configurations.loader.singleFile)
    }
    from(configurations.runtimeClasspath) {
        into "BOOT-INF/lib"
    }
    from(sourceSets.main.output) {
        into "BOOT-INF/classes"
    }
    manifest {
        attributes(
            "Main-Class": "org.springframework.boot.loader.JarLauncher",
            "Start-Class": "smoketest.simple.SampleSimpleApplication"
        )
    }
}

The manifest's Start-Class attribute should be modified to match the particular smoke test. We haven't seen much need for this so we could:

  1. Consider the above to be sufficient and close the issue
  2. Update the wiki with the above
  3. Create a new smoke-test plugin in buildSrc that does all of the above other than setting the Start-Class and apply it to every smoke test project.

Comment From: philwebb

I feel like we can probably just close this issue. I don't think we've really needed to create fat jars that often, and if we do we can just create a throw-away app using start.spring.io.