繁体   English   中英

可执行 jar 的 Gradle 类路径

[英]Gradle Class-Path for executable jar

我想用gradle生成我的java项目的可执行jar文件。 但是,我无法弄清楚如何引用我的依赖项的 jar,因为它们位于项目外的某个缓存目录中。 我怎样才能让他们进入我的项目。

这些是我的依赖项:

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:29.0-jre'

// Use JUnit test framework
testImplementation 'junit:junit:4.13'

implementation 'mysql:mysql-connector-java:8.0.19'
implementation 'org.hibernate:hibernate-core:5.4.12.Final'
implementation 'org.hibernate.validator:hibernate-validator:6.0.18.Final'
implementation 'org.hibernate:hibernate-c3p0:5.4.21.Final'
implementation 'org.reflections:reflections:0.9.11'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.2'
}

感谢您的帮助!

看看application插件,它将为您处理这个问题。

特别是,这个插件有distZipdistTar任务,它们将为您的应用程序创建一个发行版,其中的依赖项位于lib文件夹中,并使用类路径设置启动脚本。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM