LoginSignup
5
2

More than 5 years have passed since last update.

Gradle で Payara Micro の Uber Jar を利用するタスクを作る

Last updated at Posted at 2016-09-03

Uber Jar については蓮沼さんの Payara 4.1.1.162 がリリースされました - GlassFish Japan を参考のこと。

Uber Jar を作る部分を、 Gradle のタスク化させる方法のメモ。

build.gradle
apply plugin: 'war'

repositories {
    mavenCentral()
}

dependencies {
    providedCompile 'fish.payara.extras:payara-micro:4.1.1.163'
}

war.baseName = 'hogehoge'

task uberJar(type: Exec, dependsOn: war) {
    def payaraJarPath = configurations
                        .providedCompile
                        .find {it.name =~ /payara-micro.*\.jar/}
                        .absolutePath

    def warFile = war.archivePath
    def uberJarPath = warFile.path.replaceAll(/\.war$/, '.jar')

    commandLine('java', '-jar', payaraJarPath, '--deploy', warFile, '--outputUberJar', uberJarPath)
}

uberJar タスクを実行したら、 build/libs の下に jar ファイルが出力される。

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2