• Stars
    star
    142
  • Rank 258,495 (Top 6 %)
  • Language
    Groovy
  • Created almost 15 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Grails Gradle Plugin

This plugin for Gradle allows you to build Grails projects. To use it, simply include the required JARs via buildscript {} and 'apply' the plugin:

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath "org.grails:grails-gradle-plugin:2.1.2"
  }
}

version "0.1"
group "example"

apply plugin: "grails"

repositories {
  grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
}

grails {
  grailsVersion = '2.4.3'
  groovyVersion = '2.3.7'
  springLoadedVersion '1.2.0.RELEASE'
}

dependencies {
  bootstrap "org.grails.plugins:tomcat:7.0.50" // No container is deployed by default, so add this
  compile 'org.grails.plugins:asset-pipeline:2.1.3' // Just an example of adding a Grails plugin
}

You must specify the grails.grailsVersion property before executing any Grails commands.

The 'grails.groovyVersion' property is a convenience for Grails 2.3.0, it may not work correctly in earlier versions, so it's best to not use it with version pre-2.3.0. Declaring grails.groovyVersion will configure a Gradle ResolutionStrategy to modify all requests for groovy-all to be for the version specified. Additionally, the ResolutionStrategy will change all requests for groovy to be groovy-all

The grails-gradle-plugin will populate the bootstrap, compile, and test classpaths with a base set of dependencies for Grails. You need to provide a container plugin such as 'tomcat' to the bootstrap classpath to enable the run-app command.

Warning If you're using a pre-1.3.5 or pre-1.2.4 version of Grails, you'll need to add this runtime dependency to your project's build file:

runtime org.aspectj:aspectjrt:1.6.8

Once you have this build file, you can create a Grails application with the 'init' task:

gradle init

Initialize a new Grails plugin project by running:

gradle init-plugin

The plugin creates standard tasks that mimic the Java lifecycle:

  • clean
  • test
  • check
  • build
  • assemble

These tasks are wrapper tasks that declare a dependsOn to Grails specific tasks. This will allow for further build customization.

  • clean [grails-clean]
  • test [grails-test]
  • assemble [grails-war or grails-package-plugin]

You can also access any Grails command by prefixing it with grails-. For example, to run the application:

gradle grails-run-app

If you want to pass in some arguments, you can do so via the grailsArgs project property:

gradle -PgrailsArgs='--inplace solr' grails-create-plugin

You can also change the environment via the env project property:

gradle -PgrailsEnv=prod grails-run-app

You can execute multiple Grails commands in a single step, but bear in mind that if you are passing grailsEnv or grailsArgs then each of the commands will execute with the same values.

Troubleshooting

  • Caused by: org.apache.tools.ant.BuildException: java.lang.NoClassDefFoundError: org/apache/commons/cli/Options

    This happens if your project depends on the groovy JAR rather than groovy-all. Change your dependency to the latter and all will be well.

  • Classloading issues, casting proxy instances to their corresponding interface

    This can be a sign of a corrupted Spring-Loaded cache directory. The plugin has spring-loaded cache in $HOME/.grails/.slcache - try cleaning that directory

More Repositories

1

grails-core

The Grails Web Application Framework
HTML
2,777
star
2

grails

A powerful web application framework based on the Groovy language
Groovy
448
star
3

grails-spring-security-core

Grails Spring Security Core Plugin
Groovy
259
star
4

grails-data-mapping

GORM - Groovy Object Mapping
Groovy
217
star
5

grails-spring-security-rest

Grails plugin to implement token-based, RESTful authentication using Spring Security
Groovy
203
star
6

grails-doc

Documentation Project For The Grails Web Application Framework
Groovy
200
star
7

grails-database-migration

Grails® framework Database Migration Plugin
Groovy
98
star
8

gorm-graphql

An automatic GraphQL schema generator for GORM
JavaScript
80
star
9

grails-quartz

This project provides integration of the Quartz scheduling framework into the Grails Framework
Groovy
76
star
10

grails-redis

Base redis plugin for Grails
Groovy
76
star
11

grails-spring-security-ui

The Spring Security UI plugin provides CRUD screens and other user management workflows.
Groovy
73
star
12

gorm-mongodb

GORM for MongoDB
Groovy
69
star
13

grails-maven

Java
67
star
14

gorm-hibernate5

GORM for Hibernate 5
Java
62
star
15

grails-views

Additional View Technologies for Grails
Groovy
56
star
16

inconsequential

Note - this is an old repository and the code has been moved to https://github.com/SpringSource/spring-data-mapping
Java
54
star
17

grails-howtos

The source and build for a set of Grails HOWTO documents
Groovy
48
star
18

grails-samples

THIS IS DEAD CODE AND HAS BEEN MOVED TO https://github.com/grails-samples/
Groovy
43
star
19

grails-profile-repository

The Grails 3 profile repository - contains metadata for Grails profiles
Groovy
38
star
20

grails-spring-security-acl

Groovy
33
star
21

grails-boot

Grails integrations with Spring Boot
Java
31
star
22

grails-maven-archetype

Shell
25
star
23

grails-static-website

Static version of the website
Groovy
24
star
24

grails-cache

Grails Cache Plugin
Groovy
23
star
25

grails-spring-security-cas

CSS
19
star
26

gorm-neo4j

GORM for Neo4j
Groovy
17
star
27

grails-gsp

GSP (Grails Server Pages) - A server-side view rendering technology based on Groovy
Groovy
15
star
28

scaffolding

Scaffolding plugin for Grails® framework
Groovy
15
star
29

grails-functional-tests-old

Groovy
14
star
30

gorm-redis

GORM for Redis
Java
13
star
31

grails-guides

Repository for Guides to using Grails
CSS
12
star
32

grails-testing-support

Trait-based testing library for Grails framework
Groovy
11
star
33

grails-gdoc-engine

Java
8
star
34

geb

Geb Functional Testing for Grails® framework
Groovy
8
star
35

grails-functional-tests-v2

Groovy
8
star
36

gorm-docs

Documentation for GORM
HTML
7
star
37

GSSC-CVE-2022-41923

Groovy
7
star
38

grails-http

Grails HTTP Utility Classes
Groovy
7
star
39

grails-gradle-plugin

Groovy
6
star
40

gorm-rest-client

An implementation of RxGORM as a REST Client
Groovy
6
star
41

gant

Gant is a Groovy way of using the Ant tasks -- Ant scripting using Groovy, no XML.
Groovy
6
star
42

grails-angularjs-scaffolding

A plugin for generating client side assets based on domain classes
Groovy
5
star
43

gorm-hibernate4

GORM for Hibernate 4
Groovy
5
star
44

grails-spring-security-oauth2

Spring security Oauth Grails 3 plugin
Groovy
5
star
45

grails-async

Repository for Grails async plugins
Groovy
4
star
46

gorm-cassandra

GORM for Cassandra
Groovy
4
star
47

grails-sts-tests

Grails STS Tests
Java
3
star
48

grails-forge

This is Grails project creator. Grails projects may be created using the browser interface, Command Line, or via CURL.
Java
3
star
49

grails-testing-tests

Groovy
3
star
50

groovy-grails-joint-build

3
star
51

grails-spring-security-core-rest-objc

Objective-C
3
star
52

grails-embedded-mongodb

Embedded MongoDB Grails Plugin
Groovy
2
star
53

grails-forge-ui

JavaScript
2
star
54

grails-wrapper

Grails Wrapper
Java
2
star
55

grails-spring-security-rest-java-client

Java
2
star
56

grails-datastore-test-support

Unit testing support for GORM
Groovy
2
star
57

grails-plugins-metadata

2
star
58

grails-plugin-converters

Legacy converters plugin
Java
2
star
59

grails-slack-redirect

HTML
1
star
60

grails-profiles-tests

Shell
1
star
61

grails-upgrade

HTML
1
star
62

basictests

This is a temporary repository to hold some initial tests for Grails 3.
CSS
1
star
63

scaffolding-old

Repository for Scaffolding core libraries
Groovy
1
star
64

groovy-rest-doc

Groovy
1
star
65

github-actions

Shell
1
star
66

grails-common-build

Common Gradle Build Scripts for Publishing Grails Core Projects
HTML
1
star
67

grails-rxgorm-docs

Documentation for RxGORM
Shell
1
star