LoginSignup
6
6

More than 5 years have passed since last update.

Gradle Jetty Ecilpse plugnのJettyのversionを変更する

Last updated at Posted at 2014-05-15

GradleからJetty9.2を使いたかったのですが、公式のJetty pluginだとJettyのverisonが古いらしい。そこでGradle Jetty Ecilpse plugnを利用することにしました。ところがデフォルトではJetty9.1だったのでなんとかします。

gradle pluginの依存性のversionを変更する

GitHubにあるGradle Jetty Ecilpse plugnの設定方法です。

build.gradle
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath (group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.+')
    }
}
apply plugin: 'jettyEclipse'

ここに細工してJetty9.1->Jetty9.2に依存性を上書きます。

build.gradle
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath('com.sahlbach.gradle:gradle-jetty-eclipse-plugin:1.9.+') {
            // groupがorg.eclipse.jettyの依存性を除外する
            exclude group: 'org.eclipse.jetty'
        }
        // 上で除外した依存性を追加
        classpath 'org.eclipse.jetty:jetty-webapp:9.2.0.M0'
        classpath 'org.eclipse.jetty:jetty-plus:9.2.0.M0'
        classpath 'org.eclipse.jetty:jetty-jsp:9.2.0.M0'
        classpath 'org.eclipse.jetty:jetty-annotations:9.2.0.M0'
    }
}
apply plugin: 'jettyEclipse'

簡単ですね。
あとはgradle jettyEclipseRunでJetty9.2が起動します。

6
6
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
6
6