Skip to content

Latest commit

 

History

History
140 lines (107 loc) · 4.17 KB

README.md

File metadata and controls

140 lines (107 loc) · 4.17 KB

Grailszk

A plugin to integrate ZK infrastructure to modern Grails. A port of ZKGrails plugin to current versions of Grails. Versions 5 and 4 are supported. Version 3 is allowed but not tested.

Migrating from ZKGrails 2.X.X

Upgrading Grails

Follow these tutorials for upgrading Grails:

Requirements


Resources

All static resources in src/main/resources/public and src/main/webapp referenced in zul files as url should be prefixed by /static/.

A properly configured zk.xml should be in src/main/WEB-INF/

grails-app install-zk-xml

Apply grailszk-gradle-plugin in build.gradle

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath "io.github.zkgroovy:grailszk-gradle-plugin:1.0.0"
    }
}

apply plugin:"io.github.zkgroovy.grailszk-gradle-plugin"

Add grailszk dependency (example)

build.gradle:

// Omitted Grails dependencies for brevity
dependencies {
    implementation "io.github.zkgroovy:grailszk:$grailszkVersion"
    implementation "org.zkoss.zk:zk:$zkVersion", {
        exclude group: "org.zkoss.zk", module: "zkplus"
    }
    implementation "org.zkoss.zk:zul:$zkVersion"
    implementation "org.zkoss.zk:zhtml:$zkVersion"
    implementation "org.zkoss.zk:zkbind:$zkVersion"
    implementation "org.zkoss.common:zel:$zkVersion"
    implementation "org.zkoss.common:zcommon:$zkVersion"
    implementation ("org.zkoss.common:zweb:$zkVersion") {
        transitive = true
        exclude module: "ResourceCaches"
    }
    implementation "org.zkoss.zk:zkplus:7.0.1"
}

configurations.all {
    exclude group: "org.zkoss.zk", module: "zkwebfragment"
    exclude group: "org.slf4j", module: "slf4j-jdk14"
}

Warning: It's important to exclude zkwebfragment dependency otherwise it might cause conflicts in the deployed war. See Deploy WAR to Apache Tomcat: Content Encoding Error

gradle.properties (see available versions):

zkVersion=9.6.0.1
grailszkVersion=4.2.3

Spring Security

In order to use this plugin with Spring Security you should have the following configuration:

build.gradle:

repositories {
    maven { url "https://mavensync.zkoss.org/maven2" }
}

dependencies {
    implementation "org.zkoss.zk:zkspring-security:4.0.1"
}

zk.xml:

<?xml version="1.0" encoding="UTF-8"?>
<zk>
    <listener>
        <listener-class>org.zkoss.spring.init.SecurityContextAwareExecutionListener</listener-class>
    </listener>
</zk>

Spring Boot dev-tools

In order to make ZK work with spring-boot-devtools without raising any errors create a META-INF/spring-devtools.properties in the grails-app/conf/ folder including Grailszk, all ZK dependencies, components, themes and plugins. e.g:

restart.include.zk=/z[\\w]+-[\\w\\d-\\.]+\\.jar
restart.include.ckez=/ckez-(.*).jar
restart.include.breeze=/breeze-(.*).jar
restart.include.grailszk=/grailszk-(.*).jar
restart.include.silvertail=/silvertail-(.*).jar
restart.include.iceblue_c=/iceblue_c-(.*).jar
restart.include.sapphire=/sapphire-(.*).jar
restart.include.codemirror=/(.*)codemirror(.*).jar

Usage

Versions below 2.5.2

Download ZK jars zkgrails2-common.jar and place them in the lib folder which must be inside the plugin root directory.

Notes

Always change the version of the project before publishing. e.g. publishing version 4 to Maven Local: ./change-version.sh -v 4 && ./gradlew -Pversion=4.2.2 publishToMavenLocal