Skip to content

developmentOnly and testAndDevelopmentOnly dependencies may prevent implementation dependencies from being included in the uber-jar #46043

Open
@luchob

Description

@luchob

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.

  1. Clone the project
  2. Navigate to the project directory and build it:
./gradlew clean build -x test
  1. You should have now commonsio-bug.jar in the project's build/libs folder.
  2. 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
  1. 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions