Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Spring Boot Dependency: Include for bootRun / Exclude for bootJar

I have a JavaAgent JAR that needs to be:

  • Included in bootRun (referenced in bootRun_ManifestJar.jar MANIFEST Class-Path)
  • NOT Included in bootJar (the App.jar BOOT-INF/lib directory).

What I've tried thus far:

compileOnly "com.quartzdesk:quartzdesk-agent:3.6.0"

This is not including the JAR in either bootRun or bootJar

runtime "com.quartzdesk:quartzdesk-agent:3.6.0"

This is including the JAR in both bootRun AND bootJar (surprised it is included in bootJar).

Any suggestions would be greatly appreciated. Thank you!

like image 347
Philip Tenn Avatar asked Feb 10 '26 16:02

Philip Tenn


1 Answers

surprised it is included in bootJar

runtime dependency means that it is not included in classpath in compile time, but it is still packaged in final jar into libs and loaded in classpath on application startup.

This is much useful for dependencies, which are not used in your application source codes like JDBC-drivers or Liquibase.

like image 139
Vladimir Shefer Avatar answered Feb 13 '26 08:02

Vladimir Shefer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!