Skip to content

Commit

Permalink
NON-ISSUE: Brash up exec jar creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuki-ma committed Jun 26, 2018
1 parent 68fbb69 commit 9fc704a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions line-bot-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,26 @@ dependencies {
compile 'com.google.guava:guava'
}

// Default bootRepackage & signArchives has task dependency issue.
// Manually define new `execBootRepackage` task and make dependency from signArchives to execBootRepackage.
bootRepackage.enabled = false
task execBootRepackage(type: BootRepackage, dependsOn: jar) {
bootRepackage {
enabled = true
executable = true
// Custom Launch Script avoid https://github.com/spring-projects/spring-boot/issues/5164
embeddedLaunchScript = file('src/main/resources/launch.script')
withJarTask = jar
classifier = 'exec'
mainClass = 'com.linecorp.bot.cli.Application'
}

signArchives.dependsOn execBootRepackage
// Reset bootRepackage dependency to remove dependency from bootRepackage to signArchives.
// This causes circular dependency.
//
// Memo: By default, bootRepackage dependsOn the all tasks creating jar including signArchives task.
// But signArchives should be after repackages.
bootRepackage.dependsOn.clear()
bootRepackage.dependsOn jar, findMainClass
signArchives.dependsOn bootRepackage

artifacts {
archives sourcesJar, javadocJar, file("$buildDir/libs/${project.name}-${project.version}.jar")
// Add exec jar into archives to be uploaded.
artifacts.add('archives', file("$buildDir/libs/${project.name}-${project.version}-${bootRepackage.classifier}.jar")) {
classifier = bootRepackage.classifier
}

0 comments on commit 9fc704a

Please sign in to comment.