fix: package application as fat JAR and fix distribution contents
All checks were successful
Release / release (push) Successful in 21s
All checks were successful
Release / release (push) Successful in 21s
This commit is contained in:
37
build.gradle
37
build.gradle
@@ -60,17 +60,21 @@ javadoc {
|
||||
source = sourceSets.main.allJava
|
||||
}
|
||||
|
||||
jar {
|
||||
tasks.named('jar') {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.register('fatJar', Jar) {
|
||||
archiveClassifier = ''
|
||||
manifest {
|
||||
attributes(
|
||||
'Main-Class': application.mainClass,
|
||||
'Main-Class': application.mainClass.get(),
|
||||
'Implementation-Title': rootProject.name,
|
||||
'Implementation-Version': "${version}"
|
||||
)
|
||||
}
|
||||
|
||||
from sourceSets.main.output
|
||||
|
||||
dependsOn configurations.runtimeClasspath
|
||||
|
||||
// Include each JAR dependency
|
||||
@@ -95,6 +99,33 @@ jar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
distributions {
|
||||
create('fat') {
|
||||
distributionBaseName = project.name
|
||||
contents {
|
||||
into('bin') {
|
||||
from(tasks.named('startScripts'))
|
||||
filePermissions {
|
||||
unix('rwxr-xr-x')
|
||||
}
|
||||
}
|
||||
into('lib') {
|
||||
from(tasks.named('fatJar'))
|
||||
}
|
||||
from('src/dist')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('assemble') {
|
||||
dependsOn tasks.named('fatDistZip'), tasks.named('fatDistTar')
|
||||
}
|
||||
|
||||
tasks.named('startScripts') {
|
||||
dependsOn tasks.named('fatJar')
|
||||
classpath = files(tasks.named('fatJar').flatMap { it.archiveFile })
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
def banner = """
|
||||
\u001B[34m
|
||||
|
||||
Reference in New Issue
Block a user