Open
Description
Problem:
In my boot project I have both testAndDevelopmentOnly
and implementation
dependencies. Here is an example:
implementation("org.apache.poi:poi:5.4.1")
implementation("org.apache.poi:poi-ooxml:5.4.1")
testAndDevelopmentOnly ("org.liquibase:liquibase-core:4.32.0")
DISCLAIMER: I know that Liquibase
is managed by spring, but this is the easiest way for me to reproduce the issue.
liquibase-core
depends on commons-io:commons-io:2.19.0
poi
depends on commons-io:commons-io:2.18.0
Gradle chooses 2.19.0 by default. But when I build my application the ueber jar contains neither commons-io:2.18.0
nor commons-io:2.19.0
. Using poi fails then with class not found exceptions.
How to reproduce
I have created a small project available in github.
- Clone the project
- Navigate to the project directory and build it:
./gradlew clean build -x test
- You should have now
commonsio-bug.jar
in the project'sbuild/libs
folder. - Extract the ueber jar so that you can check its contents, e.g.:
java -Djarmode=tools -jar ./build/libs/commonsio-bug.jar extract --layers --destination extracted
- Navigate to
extracted/dependencies/lib
Commons IO is not there and poi will throw class not found exceptions because it depends on it.
Dependencies
Spring boot: 3.5.2
io.spring.dependency-management: 1.1.7