Skip to content
Zealin edited this page Oct 19, 2012 · 5 revisions

Simple Example

Gradle GWT Plugin

Examples for single and multi folder projects

GWT configuration closure: Standard values (if not set in closure):


Example for single folder project build.gradle

apply plugin: 'cat-gwt'

dependencies {  
  gwtBuild (
    [project(path: ':', configuration: 'gwtCompile')]
  )
  
  compile 'com.google.gwt:gwt-servlet:' + ext.gwtVersion
}

sourceSets {
  main {
    java {
      srcDir 'src'
    }
    resources {
      srcDir 'src'
    }
  }
}

gwt {
  modules {
    StockWatcher {
      modulename = 'com.google.gwt.sample.stockwatcher.StockWatcher'
    }
  }
  
  eclipse {
    codeSrvStartupUrl 'http://localhost:8888/index.html'
  }
  
  warFolder = 'war'
  workers = '2'
}

Example for multi folder project

  • /baseDir/build.gradle
  • /baseDir/settings.gradle
  • /baseDir/project1/build.gradle
  • /baseDir/project2/build.gradle

/baseDir/build.gradle

apply plugin: 'cat-gwt'

dependencies {
  gwtBuild (
    [project(path: ':projectX', configuration: 'gwtCompile')]
  )
}

subprojects {
  // apply plugin: 'xxx'
  
  sourceSets {
    main {
      java {
        srcDir 'src'
      }
      resources {
        srcDir 'src'
      }
    }
  }
}

gwt {
  modules {
    projectX {
      modulename = 'cc.catalysts.gwt.example.projectX'
    }
  }
  
  eclipse {
    codeSrvStartupUrl 'http://localhost:8888/index.html'
  }
}

/baseDir/settings.gradle

include 'project1', 'project2'

/baseDir/project1/build.gradle

apply plugin: 'cat-gwt'

artifacts { // if needed
  gwtCompile jar
}

dependencies {
  compile project(':project2') // depends on project2
  
  compile 'com.google.gwt:gwt-servlet:2.4.0' // if needed
}

/baseDir/project2/build.gradle

apply plugin: 'cat-gwt'

artifacts { // if needed
  gwtCompile jar
}

dependencies {
  compile 'com.google.gwt:gwt-servlet:2.4.0' // if needed
}