gradleメモ
Version | |
---|---|
Gradle | 6.5 |
Windows環境の人は最新化は再ダウンロードしましょう
gradlew 生成
gradle wrapper
gradlew によるバージョン更新
./gradlew wrapper --gradle-version=6.5
Executable Fat Jar(実行可能Jar)
implementationの依存関係もちゃんと取り込む。
task fatJar(type: Jar) {
archiveBaseName = "アーカイブベース名"
// archiveClassifier = 'アーカイブ分類名'
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
manifest {
attributes 'Main-Class': "メインクラス完全修飾名"
}
}
依存ライブラリをフォルダにかき集める例
task fatJarDependCopy(type: Copy){
println "fatJarDependCopy called."
from {
configurations.runtimeClasspath
}
into "build/libs/lib"
}
// サブプロくジェクトはJar化して調達すべし。
task fatJar(type: Jar) {
dependsOn fatJarDependCopy
archiveBaseName = "アーカイブベース名"
// archiveClassifier = ''
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
def manifestClasspath = configurations.runtimeClasspath.collect { "lib/" + it.getName() }.join(' ')
manifest {
attributes 'Main-Class': "メインクラス名"
attributes 'Class-Path': manifestClasspath
}
}
Author And Source
この問題について(gradleメモ), 我々は、より多くの情報をここで見つけました https://qiita.com/OmeletteCurry19/items/8b6894ad5f4dcfcd5e81著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .