簡體   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