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:
41
build.gradle
41
build.gradle
@@ -60,17 +60,21 @@ javadoc {
|
|||||||
source = sourceSets.main.allJava
|
source = sourceSets.main.allJava
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
tasks.named('jar') {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('fatJar', Jar) {
|
||||||
|
archiveClassifier = ''
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
attributes(
|
||||||
'Main-Class': application.mainClass,
|
'Main-Class': application.mainClass.get(),
|
||||||
'Implementation-Title': rootProject.name,
|
'Implementation-Title': rootProject.name,
|
||||||
'Implementation-Version': "${version}"
|
'Implementation-Version': "${version}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
from sourceSets.main.output
|
|
||||||
|
|
||||||
|
from sourceSets.main.output
|
||||||
dependsOn configurations.runtimeClasspath
|
dependsOn configurations.runtimeClasspath
|
||||||
|
|
||||||
// Include each JAR dependency
|
// Include each JAR dependency
|
||||||
@@ -95,6 +99,33 @@ jar {
|
|||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
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 ->
|
gradle.taskGraph.whenReady { taskGraph ->
|
||||||
def banner = """
|
def banner = """
|
||||||
\u001B[34m
|
\u001B[34m
|
||||||
|
|||||||
Reference in New Issue
Block a user