Gradle GWT Plugin For Modern Web applications using NPM/Webpack
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper switch to kotlin dsl Nov 29, 2018
src/main/groovy/us/ascendtech ignore duplicates Dec 7, 2018
.gitignore check in version 0.1 of plugin Jun 14, 2018
LICENSE Initial commit Jun 14, 2018
README.md Update README.md Jul 6, 2018
build.gradle.kts ignore duplicates Dec 7, 2018
gradlew check in version 0.1 of plugin Jun 14, 2018
gradlew.bat check in version 0.1 of plugin Jun 14, 2018

README.md

See below for npm plugin

gwt.modern

A plugin for GWT 2.8.x projects using webpack and npm. Aims to be ready for GWT 3.x. Compiles to archive file for deploy on web server.

Work in progess examples can be found https://github.com/ascendtech/gwt-examples

Basic Usage

build.gradle

plugins {
  id "us.ascendtech.gwt.modern" version "0.2.3"
}

gwt {
    modules = ['com.company.SomeModule']   
}

gwt lib

//gwt lib build.gradle
plugins {
    id "us.ascendtech.gwt.lib" version "0.2.3"
}

//app build.gradle
plugins {
  id "us.ascendtech.gwt.modern" version "0.2.3"
}
gwt {
    modules = ['com.company.SomeModule']   
}

dependencies {
    compile project(':someGwtLibProject')   
}

Compile to tar gz bundle for deploy on web server

gradle gwtArchive #archive in build/webapp

Run gwt devmode with webpack backend

gradlew gwtDev

#new terminal
gradlew webpackDev

#if using annotation processing (autorest or vue-gwt)
#new terminal
gradle compileJava -t

gwt.classic

A plugin for GWT 2.8 projects. Compiles to war

Basic Usage

build.gradle

plugins {
  id "us.ascendtech.gwt.classic" version "0.2.3"
}

gwt {
    modules = ['com.company.SomeModule']   
}

gwt lib

//gwt lib build.gradle
plugins {
    id "us.ascendtech.gwt.lib" version "0.2.3"
}

//app build.gradle
plugins {
  id "us.ascendtech.gwt.classic" version "0.2.3"
}
gwt {
    modules = ['com.company.SomeModule']   
}

dependencies {
    compile project(':someGwtLibProject')   
}

Create war

gradle war #war file in build/libs

npm-gradle

A plugin that downloads and runs NPM and webpack. Based on the work of https://github.com/solugo/gradle-nodejs-plugin. NodeJS is downloaded to ~/.nodejs/version/.

NPM

build.gradle

plugins {
    id "us.ascendtech.js.npm" version "0.2.3"
}

//all optional, defaults shown
npm {
   nodeJsVersion = "10.4.0"
   webpackInputBase = "./src/main/webapp/"
   contentBase = "./src/main/webapp/public/"
}

sample package.json

{
  "name": "somename",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {},
  "keywords": [],
  "author": "",
  "license": "",
  "devDependencies": {
    "css-loader": "^0.28.11",
    "style-loader": "^0.21.0",
    "webpack": "^4.12.0",
    "webpack-cli": "^2.1.4",
    "webpack-dev-server": "^3.1.4"
  },
  "dependencies": {
    "ag-grid": "^17.1.1",
    "ag-grid-vue": "^17.1.0",
    "npm": "^6.1.0",
    "vue": "^2.5.16",
    "vue-router": "^3.0.1",
    "vuetify": "^1.0.18"
  }
}

sample webpack.config.js

module.exports = {
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue.esm.js'
        },
        extensions: ['*', '.js', '.vue', '.json']
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            }
        ]
    },
    entry: {
        app: ["./src/main/webapp/js/index.js"]
    },
    output: {
        filename: "bundle.js"
    },
    devServer: {
        proxy: {
            '/someapi': {
                target: 'http://localhost:12111',
                ws: true,
                changeOrigin: true
            },
            '/login': {
                target: 'http://localhost:12222',
                ws: true,
                changeOrigin: true
            }
        }
    }
}

NPM tasks

gradle npmClean #rm -rf node_modules

gradle npmInstall #npm install

gradle npmInstallSave --npmModule vue #npm install vue --save
gradle npmInstallSaveDev --npmModule vue #npm install vue --save-dev

gradle webpack #webpack-cli --mode=production --output-path build/js
gradle webpackDev #webpack-dev-server --mode development --content-base ${npm.contentBase}