简体   繁体   English

Gradle Spring 引导依赖:包括用于 bootRun / 排除用于 bootJar

[英]Gradle Spring Boot Dependency: Include for bootRun / Exclude for bootJar

I have a JavaAgent JAR that needs to be:我有一个 JavaAgent JAR 需要:

  • Included in bootRun (referenced in bootRun_ManifestJar.jar MANIFEST Class-Path)包含在bootRun中(在bootRun_ManifestJar.jar MANIFEST 类路径中引用)
  • NOT Included in bootJar (the App.jar BOOT-INF/lib directory).不包含在bootJar (App.jar BOOT-INF/lib目录)中。

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这不包括bootRun或 bootJar 中的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 ).这包括bootRun和 bootJar 中的bootJar (很惊讶它包含在bootJar中)。

Any suggestions would be greatly appreciated.任何建议将不胜感激。 Thank you!谢谢!

surprised it is included in bootJar很惊讶它包含在 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. runtime依赖意味着它在编译时不包含在类路径中,但它仍然在最终的jar中打包到libs中,并在应用程序启动时加载到类路径中。

This is much useful for dependencies, which are not used in your application source codes like JDBC-drivers or Liquibase.这对于依赖关系非常有用,这些依赖关系不会在您的应用程序源代码(如 JDBC 驱动程序或 Liquibase)中使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过Spring Boot Gradle Plugin和bootJar任务有条件地排除Java文件? - How can I exclude a java file conditionally with the Spring Boot Gradle Plugin and bootJar task? Intellij spring boot run 不工作 gradle bootRun - Intellij spring boot run not working gradle bootRun Spring Boot gradle - 没有方法签名:.bootJar() 适用于参数类型 - Spring boot gradle - getting No signature of method: .bootJar() is applicable for argument types 并行启动多个Gradle“spring-boot”插件“bootRun”任务 - Launch multiple Gradle “spring-boot” plugin “bootRun” tasks in parallel 使用参数使用bootRun与Gradle运行spring boot应用 - Run spring boot app with gradle with bootRun using arguments Spring Boot bootRun在Java 6上 - Spring Boot bootRun on Java 6 Spring Boot,Gradle和Visual Studio代码-Gradle bootRun任务无法正常工作 - Spring Boot, Gradle, and Visual Studio Code - Gradle bootRun Task Not Working Correctly 尝试使用gradle bootrun进行编译并获取找不到spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT - Trying to compile with gradle bootrun and get cannot find spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT Gradle-从依赖项中排除spring.xml - Gradle - Exclude spring.xml from a dependency 在build.gradle中提供了runtime spring-boot-starter-undertow,但是:bootRun仍然使用Tomcat而不是undertow - providedRuntime `spring-boot-starter-undertow` in `build.gradle` but `:bootRun` still using Tomcat instead of undertow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM