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

Viewed 460

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!

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.

Related