Skip to content
Zealin edited this page Nov 23, 2012 · 16 revisions

catalysts-gradle-plugins

A collection of reusable gradle plugins.

Usage

catalysts-gradle-plugins is work-in-progress and not yet published on maven central. If you 're curious, you can try it out by downloading the source and placing it into the buildSrc directory of your gradle project.

List of plugins

Grails

Applies grails nature to your project by updating the source sets, configure sonar (if available), and adding test and build tasks. If the project is an grails application (not a plugin), it adds a war task. It includes gradle-grails-wrapper for the grails-* tasks and automatic download of the specified grails version.

Example:

apply plugin: 'cat-grails'
grails {
    version = '2.1.1'
}

Now the war task on every grails application (usually one) builds the war file with the specified grails version. If you want to test your app before creating the archive, use the build task.

You can rename (or move) the produced war file(s) by setting the grails.project.war.file option in your BuildConfig.groovy or with a simple gradle task, eg.

task build(type: Sync, dependsOn: ':your-grails-app:build') {
    from 'your-grails-app/target'
	into 'build'
	include '*.war'
	rename '(.*).war', 'ROOT.war'
}

LESS

Converts your .less files to .css. You don't have to install the less executable on your machine - this plugin includes lesscss-engine.

Example:

apply plugin: 'cat-less'
less {
   sourceFiles = fileTree(dir: 'less', include: '*.less')
   outputDirectory = file('web-app/css')
}

The output gets compressed by default. You can disable this behaviour by setting compress = false.

Compiles GWT (to do so it applies gradle default plugins 'java' and 'eclipse' and mavenCentral() as repository)
GWT version is configurable in build.gradle via "ext.gwtVersion" (default: '2.4.0')

Example for single / multi project projects Wiki

Stops specified running tomcat service, copy the artifacts into the desired server directory(appends /webapps/, clears log and work directory) and then starts the tomcat service For usage example see Wiki

JAXB

Generates code from all JAXB sources specified in build.gradle (may be a list)
WSDL files will be generated to '/target/generated-sources/${sourceSet.name}/wsdl' from schema files from 'src/${sourceSet.name}/wsdl'
XSD files will be generated to '/target/generated-sources/${sourceSet.name}/xsd' from schema files from 'src/${sourceSet.name}/xsd'

Example for wsdl:

apply plugin: 'cat-jaxb'
jaxb {
	wsdl {
		convert 'FILENAME.wsdl'
	}
}

Example for xsd:

apply plugin: 'cat-jaxb'
jaxb {
	xsd {
		convert 'FILENAME.xsd'
	}
}

QUERYDSL

Generates QueryDsl for given Project to 'target/generated-sources/querydsl' (extends compileJava task)
This folder will be added to the SourceSet.
The '/target' directory will be deleted when running 'gradle clean'.
Example:

apply plugin: 'cat-querydsl'

JAVAGEN

Gradle wrapper plugin for cdoclet Target path for generated source: "${project.projectDir}/target/generated-sources" Example:

apply plugin: 'cat-javagen'
dependencies  {
	javagen project(':PROJECTNAME')
}

This plugin can be used to create the build file 'Build.java' into '/target/generated-sources/main/' + package path.
For more details see codegen-java

Gradle wrapper plugin for antlr v3
For extended usage example see Wiki Example:

apply plugin: 'cat-antlr3'
antlr3 {
    generate 'XYZ.g->cc.catalysts.example.parser'
}
Clone this wiki locally