Hi,

I'm trying to use the V2.0.0.M1 of the gradle-spring-boot plugin to create a fatJar since I don't want the dependency management that comes with the V1. I need to unpack my entities so Hibernate can see them. I have a multi-project structure (meaning my main gradle file contains a subprojects section) and the main app has also its own gradle file. I tried to unpack using the following code:

buildscript {
    ext {
        springBootVersion = '2.0.0.BUILD-SNAPSHOT'
    }
    repositories {
        maven { url 'https://repo.spring.io/libs-snapshot' }
    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
    }
}

apply plugin: 'org.springframework.boot'

// Hibernate cannot find the entities inside the nested jar
bootJar {
    requiresUnpack "io.pleo:pleo-styx-data"
}

But it simply doesn't work. However, the V1 version works:

plugins {
    id 'org.springframework.boot' version '1.5.3.RELEASE'
}

// Hibernate cannot find the entities inside the nested jar
springBoot {
    requiresUnpack = ["io.pleo:pleo-styx-data"]
}

I suspect that it is a bug, but since nobody seems to use the V2 and the documentation is not very up to date (requiresUnpack is now a function instead an attribute for example), its hard to tell.

Comment From: wilkinsona

As described in the documentation, you now need to use an Ant-style pattern to match the jar(s) that should be unpacked.

Using an Ant-style pattern allows jar files from any source (a file dependency, for example) to be identified, and not just those that are resolved as a Maven dependency.

Comment From: Sytten

Thanks for the link! I never saw that documentation before, I will try that.

Comment From: kweckwerth-cd

The link no longer works. I'm having the same issue with Spring Boot 2.2.6. Any docs?

Comment From: snicoll

@kweckwerth-cd thanks for reporting a dead link, we'll investigate. That said, the link is on current-SNAPSHOT and Andy commented 4 years ago (to this day). Please consider searching the doc first before adding a comment.

https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable.configuring.unpacking