Locked History Actions

Diff for "gradle/gwt-plugin"

Differences between revisions 2 and 3
Deletions are marked like this. Additions are marked like this.
Line 55: Line 55:
  modules 'jp.foobar.sample'   modules 'jp.foobar.sample.sample'

gwtプラグインの使い方

gwt用のプラグインを作ってる人がいる。

2015/8時点での最新安定版は0.6のようだ。

GWT、Eclipse用GWTプラグイン、Gradle、Eclipse用Gradleプラグインはインストール済との前提で、gwt-gradle-pluginを使用する方法を以下に記述する。

Eclipseプロジェクトの作成

GWTプロジェクトの作成

EclipseのFileメニューからNew>Otherを選択、Google>Web Application Projectを選択。 プロジェクト名をsample、パッケージ名をjp.foobar.sample、Use Google Web Toolkitで2.6.1を指定、Use Google App EngineのチェックをOFFしてFinish。

Gradleプロジェクトへの変換

プロジェクト名を右クリックしてメニューからConfigure>Convert to Gradle Project。プロジェクト名を右クリックして、New>Fileでbuild.gradleを作成。

※CENTRAL_REPOSITORYプロパティはあらかじめ定義されていること。

// gwt-pluginのバージョン0.6をダウンロード
buildscript {
  repositories {
    maven {
     url CENTRAL_REPOSITORY
    }
  }
  dependencies {
    classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
  }
}

apply plugin: 'war'

// gwtプラグインの使用
apply plugin: 'gwt'

repositories {
  maven {
   url CENTRAL_REPOSITORY
  }
}

gwt {
  // 使用するgwtのバージョン
  gwtVersion='2.6.1'

  // モジュール名
  modules 'jp.foobar.sample.sample'
}

// デフォルトで想定されるソースパスとは異なる
sourceSets {
  main {
    java {
      srcDir 'src'
    }
    resources {
      srcDir 'src'
    }
  }
}

gradleプロジェクトに変換した時点で、プロジェクトのjava Build Pathのソースもライブラリも空になっているので、以下を行って再設定する。 プロジェクトを右クリックし、Gradle>Refresh Dependencies及びGradle>Refresh SourceFolders