SlideShare a Scribd company logo
1 of 29
Download to read offline
Gradle 
-­‐ 
Build 
system 
evolved 
By 
Bhagwat 
Kumar
Agenda 
• What 
and 
Why? 
• Key 
features 
of 
Gradle 
• Project 
and 
tasks 
• Using 
java/groovy/war/jetty 
plugins 
• Manage 
dependency 
• Working 
with 
multi-­‐module 
project 
• Create 
grails 
application 
using 
Gradle 
2
What 
is 
Gradle? 
• A 
general-­‐purpose 
build 
automation 
tool. 
It 
can 
automate 
• 
building 
• testing 
• deployment 
• publishing 
• generate 
static 
websites 
• generate 
documentation 
• indeed 
anything 
else 
• Designed 
to 
take 
advantage 
of 
convention 
over 
configuration. 
• Combines 
the 
power 
and 
flexibility 
of 
Ant 
with 
the 
dependency 
management 
and 
conventions 
of 
Maven 
into 
a 
more 
effective 
way 
to 
build. 
3
Why 
Gradle? 
• Powerful 
and 
expressive 
Groovy 
DSL 
instead 
of 
XML. 
• Adaptable 
to 
nonconventional 
project 
structures. 
• Works 
well 
for 
java 
as 
well 
as 
non 
java 
projects. 
• Extensible 
(plugins!). 
• Multi 
project 
builds 
are 
hassle 
free. 
• Powerful 
dependency 
management. 
• Reduced 
start 
up 
cost 
using 
Gradle 
daemon. 
• Caching 
of 
task 
input 
output. 
• Introduced 
to 
Android 
with 
Android 
Studio. 
• Grails 
3.0 
build 
system 
will 
be 
updated 
to 
use 
Gradle.
Combines 
best 
features 
from 
other 
build 
tools. 
Image 
source 
: 
http://www.drdobbs.com/jvm/why-­‐build-­‐your-­‐java-­‐projects-­‐with-­‐gradle/240168608
Features 
Image 
source 
: 
http://www.drdobbs.com/jvm/why-­‐build-­‐your-­‐java-­‐projects-­‐with-­‐gradle/240168608
Who 
are 
using?
Installation 
Using 
gvm 
$ 
gvm 
install 
gradle 
$ 
gradle 
-­‐v 
$ 
gradle 
init 
$ 
gradle 
tasks 
Access 
gradle 
documentation 
from 
local 
file 
system 
{USER_HOME}/.gvm/gradle/current/docs/userguide/userguide.pdf
Gradle 
Build 
Script 
• build.gradle 
file 
in 
project 
root 
directory. 
• Its 
actually 
a 
groovy 
script. 
• This 
is 
where 
you 
define 
gradle 
tasks. 
• Every 
Gradle 
build 
is 
made 
up 
of 
one 
or 
more 
projects. 
9
Gradle 
project 
• It 
does 
not 
necessarily 
represent 
a 
thing 
to 
be 
built. 
• It 
might 
represent 
a 
• library 
jar 
• web-­‐app 
• distribution 
zip 
assembled 
from 
the 
JARs 
produced 
by 
other 
projects 
• thing 
to 
be 
done 
: 
deploy 
to 
staging 
server 
10
Gradle 
Tasks 
• An 
atomic 
piece 
of 
work 
that 
a 
build 
performs. 
• compile 
classes 
• create 
jar 
• generate 
java 
doc 
• publish 
some 
archive 
to 
a 
repository 
• Each 
project 
is 
made 
up 
of 
one 
or 
more 
tasks 
11
build.gradle 
task 
hello 
<< 
{ 
Defines 
task 
'hello' 
with 
groovy 
closure. 
println 
"Hello 
!!!!" 
} 
task 
greet 
<<{ 
println 
"Welocome 
Mr. 
Kumar" 
} 
task 
intro(dependsOn: 
hello) 
<< 
{ 
println 
"I'm 
Gradle" 
Defines 
task 
'intro' 
which 
depends 
on 
'hello' 
task 
appends 
additional 
groovy 
closure 
to 
be 
executed 
to 
existing 
'hello' 
task 
} 
hello 
<< 
{ 
println 
"Hello 
extended!!!!" 
} 
greet.dependsOn 
hello, 
intro 
// 
gradle 
tasks 
:list 
all 
the 
available 
tasks 
// 
gradle 
intro 
:executes 
intro 
task 
// 
gradle 
-­‐q 
greet 
:bare 
build 
output 
// 
gradle 
-­‐-­‐daemon 
hello 
:subsequent 
execution 
will 
be 
fast 
gradle 
tasks 
are 
groovy 
objects. 
You 
can 
change 
dependency 
of 
existing 
tasks
Using 
plugins 
• Gradle 
core 
intentionally 
provides 
very 
little 
for 
automation. 
• All 
of 
the 
useful 
features 
are 
added 
by 
plugins. 
e.g. 
java 
compile. 
• Gradle 
plugins 
• add 
new 
tasks 
(e.g. 
JavaCompile) 
• add 
domain 
objects 
(e.g. 
SourceSet) 
• add 
conventions 
(e.g. 
Java 
source 
is 
located 
at 
src/main/java) 
• extends 
core 
objects 
and 
objects 
from 
other 
plugins 
• Plugin 
portal 
: 
http://plugins.gradle.org/ 
13
Applying 
plugins 
14 
Script 
plugins 
//from 
a 
script 
on 
the 
local 
filesystem 
or 
at 
a 
remote 
location. 
apply 
from: 
'other.gradle' 
Binary 
plugins 
// 
applying 
a 
binary 
plugin 
by 
type 
apply 
plugin: 
'java' 
Using 
plugins 
DSL 
//version 
is 
optional 
plugins 
{ 
id 
"com.jfrog.bintray" 
version 
"0.4.1" 
}
Using 
java 
plugin 
• New/modified 
tasks 
• clean, 
compileJava, 
classes, 
jar, 
uploadArchives, 
build 
etc. 
• Default 
project 
layout 
• src/main/java 
• src/main/resources 
• src/test/java 
• Dependency 
configurations 
• compile, 
runtime, 
testCompile, 
archives 
etc. 
• Convention 
properties 
• sourceSets, 
sourceCompatibility, 
archivesBaseName 
etc. 
15
Changing 
project 
layout 
for 
java 
plugin 
16 
apply 
plugin: 
'java' 
sourceSets 
{ 
main 
{ 
java 
{ 
srcDirs 
= 
['source/main/java'] 
} 
} 
test 
{ 
java 
{ 
srcDirs 
= 
['source/test/java'] 
} 
} 
|-­‐-­‐ 
build.gradle 
|-­‐-­‐ 
settings.gradle 
`-­‐-­‐ 
source 
`-­‐-­‐ 
main 
`-­‐-­‐ 
java 
`-­‐-­‐ 
com 
`-­‐-­‐ 
intelligrape 
`-­‐-­‐ 
gradle 
`-­‐-­‐ 
Application.java 
package 
com.intelligrape.gradle.demo; 
public 
class 
Application 
{ 
public 
static 
void 
main(String[] 
args) 
{ 
System.out.println("Hello 
Gradle!!!"); 
} 
} 
Application.java
A 
task 
to 
execute 
java 
class 
17 
build.gradle 
apply 
plugin: 
'java' 
task 
runMe(type: 
JavaExec, 
dependsOn: 
'classes') 
{ 
main 
= 
"com.intelligrape.gradle.demo.Application" 
classpath 
= 
sourceSets.main.runtimeClasspath 
} 
Execute 
java 
class 
using 
'runMe' 
task 
$ 
gradle 
-­‐q 
runMe 
Hello 
Gradle!!! 
Or 
execute 
using 
java 
command 
$ 
gradle 
-­‐q 
build 
$java 
-­‐cp 
build/classes/main 
com.intelligrape.gradle.demo.Application 
Hello 
Gradle!!!
Configure 
jar 
manifest 
apply 
plugin: 
'java' 
sourceCompatibility 
= 
1.5 
//controls 
jar 
file 
name 
version 
= 
'1.0-­‐snapshot' 
archivesBaseName="sample-­‐java" 
//self 
executable 
jar 
jar 
{ 
manifest 
{ 
attributes("Main-­‐Class": 
"com.intelligrape.manifest.Application", 
"Implementation-­‐Version": 
version) 
} 
} 
$ 
gradle 
-­‐q 
build 
$java 
-­‐jar 
build/lib/sample-­‐java-­‐1.0-­‐snapshot.jar 
Hello 
Gradle!!!
Dependency 
management 
apply 
plugin: 
'java' 
repositories 
{ 
//mavenLocal() 
mavenCentral() 
//maven 
{ 
url 
"http://repo.mycompany.com/maven2"} 
//flatDir 
{ 
dirs 
'lib1', 
'lib2'} 
} 
dependencies 
{ 
compile 
"org.quartz-­‐scheduler:quartz:2.1.5" 
testCompile 
group: 
'junit', 
name: 
'junit', 
version: 
'4.11' 
compile 
project(':shared') 
//project 
dependency 
runtime 
files('libs/a.jar', 
'libs/b.jar') 
//file 
dependency 
}
Working 
with 
groovy 
plugin 
• Groovy 
plugin 
extends 
the 
Java 
plugin 
to 
add 
support 
for 
Groovy 
projects. 
• It 
can 
deal 
with 
Groovy 
code, 
mixed 
Groovy 
and 
Java 
code, 
and 
even 
pure 
Java 
code. 
• New/modified 
tasks 
• compileGroovy, 
groovyDoc, 
classes 
etc 
• Project 
layout 
• src/main/groovy 
• src/test/groovy 
• You 
must 
add 
dependency 
for 
groovy 
• compile 
localGroovy() 
• compile 
'org.codehaus.groovy:groovy-­‐all:2.3.6'
build.gradle 
with 
groovy 
plugin 
apply 
plugin: 
'groovy' 
repositories 
{ 
mavenCentral() 
} 
dependencies 
{ 
// 
compile 
localGroovy() 
compile 
'org.codehaus.groovy:groovy-­‐all:2.3.6' 
} 
sourceSets 
{ 
main 
{ 
groovy 
{ 
srcDirs 
= 
['source/groovy'] 
} 
} 
test 
{ 
groovy 
{ 
srcDirs 
= 
['source/groovy'] 
} 
} 
}
Using 
war 
and 
jetty 
plugin 
apply 
plugin: 
"war" 
//gradle 
assemble 
//apply 
plugin: 
"jetty" 
//gradle 
jettyRun 
version 
= 
"1.0.0" 
archivesBaseName 
= 
"multi-­‐web" 
repositories 
{ 
mavenCentral() 
} 
dependencies 
{ 
compile 
project(":utils") 
compile 
"javax.servlet:servlet-­‐api:2.5" 
} 
|-­‐-­‐ 
build.gradle 
`-­‐-­‐ 
src 
`-­‐-­‐ 
main 
|-­‐-­‐ 
java 
| 
`-­‐-­‐ 
com 
| 
`-­‐-­‐ 
intelligrape 
| 
`-­‐-­‐ 
web 
| 
`-­‐-­‐ 
HomeServlet.java 
`-­‐-­‐ 
webapp 
|-­‐-­‐ 
WEB-­‐INF 
| 
`-­‐-­‐ 
web.xml 
`-­‐-­‐ 
index.jsp
Working 
with 
multi-­‐project 
build.gradle 'hello' 
task 
is 
added 
to 
root 
as 
well 
as 
all 
the 
sub 
projects 
allprojects 
{ 
task 
hello 
<< 
{ 
task 
-­‐> 
println 
"I'm 
$task.project.name" 
} 
} 
subprojects 
{ 
Applied 
to 
only 
sub 
projects 
task 
onlySubProjectTask 
<< 
{ 
task 
-­‐> 
println 
"I'm 
$task.project.name" 
} 
apply 
plugin: 
"java" 
repositories 
{ 
mavenCentral() 
} 
java 
plugin 
applied 
to 
all 
subproj 
Applied 
to 
only 
root 
project 
} 
task 
onlyMainProjectTask 
<< 
{ 
task 
-­‐> 
println 
"Only 
Main 
Project 
Task 
: 
${task.project.name} 
" 
} 
multi-­‐project/ 
|-­‐-­‐ 
build.gradle 
|-­‐-­‐ 
settings.gradle 
|-­‐-­‐ 
top 
| 
`-­‐-­‐ 
build.gradle 
`-­‐-­‐ 
util 
`-­‐-­‐ 
build.gradle 
settings.gradle 
rootProject.name 
= 
'multi-­‐project' 
include 
'util', 
'top'
Working 
with 
multi-­‐project 
cont... 
Executing 
'hello' 
task 
: 
executed 
for 
all 
projects 
$ 
gradle 
hello 
:hello 
I'm 
multi-­‐project 
:top:hello 
I'm 
top 
:util:hello 
I'm 
util 
Executing 
'onlySubProjectTask' 
task 
: 
executed 
for 
only 
sub-­‐projects 
$ 
gradle 
onlySubProjectTask 
:top:onlySubProjectTask 
I'm 
top 
:util:onlySubProjectTask 
I'm 
util 
Execute 
hello 
task 
of 
'top' 
sub-­‐project 
only 
$ 
gradle 
:top:hello 
:top:hello 
I'm 
top
Using 
grails-­‐gradle 
plugin 
buildscript 
{ 
repositories 
{ 
jcenter() 
} 
dependencies 
{classpath 
"org.grails:grails-­‐gradle-­‐plugin:2.0.0"} 
} 
version 
"0.1" 
group 
"example" 
apply 
plugin: 
"grails" 
grails 
{ 
grailsVersion 
= 
'2.3.6' 
springLoadedVersion 
'1.1.3' 
groovyVersion 
= 
'2.3.6' 
} 
repositories 
{ 
//maven 
repo 
for 
the 
Grails 
Central 
repository 
(Core 
libraries 
and 
plugins) 
grails.central() 
} 
dependencies 
{ 
// 
No 
container 
is 
deployed 
by 
default, 
so 
add 
this 
bootstrap 
"org.grails.plugins:tomcat:7.0.50" 
// 
Just 
an 
example 
of 
adding 
a 
Grails 
plugin 
compile 
'org.grails.plugins:resources:1.2' 
}
Using 
grails-­‐gradle 
plugin 
continued 
• Create 
build.gradle 
file 
and 
copy 
content 
from 
previous 
slide. 
• Execute 
'gradle 
init' 
which 
will 
create 
file 
structure 
• To 
run 
app 
execute: 
• gradle 
gradle-­‐run-­‐app 
• The 
plugin 
configures 
a 
Gradle 
Task 
Rule 
to 
allow 
execution 
of 
any 
available 
Grails 
scripts 
as 
Gradle 
tasks. 
Simply 
prefix 
the 
Grails 
script 
name 
with 
grails-­‐ 
and 
execute 
from 
Gradle. 
• e.g. 
'gradle 
grails-­‐refresh-­‐dependencies' 
• Passing 
arguments 
to 
Grails 
Tasks 
: 
• gradle 
-­‐PgrailsArgs="FooController" 
grails-­‐create-­‐controller 
• Setting 
the 
Grails 
Environment 
: 
• gradle 
-­‐PgrailsEnv=prod 
grails-­‐run-­‐app 
26
Q/A 
27
Thank 
you. 
28 
Blog: 
http://www.intelligrape.com/blog/author/bhagwat 
LikedIn: 
http://www.linkedin.com/in/bhagwatkumar 
Twitter: 
http://twitter.com/bhagwatkumar 
Mail 
: 
bhagwat@intelligrape.com
References 
29 
http://www.gradle.org/docs/current/userguide/userguide_single.html 
http://www.gradle.org/docs/current/userguide/java_plugin.html 
http://www.gradle.org/docs/current/userguide/groovy_plugin.html 
http://plugins.gradle.org/ 
http://mrhaki.blogspot.in/2010/09/gradle-goodness-run-java-application.html 
http://mrhaki.blogspot.in/2009/11/using-gradle-for-mixed-java-and-groovy.html 
http://rominirani.com/2014/07/28/gradle-tutorial-part-1-installation-setup/ 
http://rominirani.com/2014/07/28/gradle-tutorial-part-2-java-projects/ 
http://rominirani.com/2014/07/29/gradle-tutorial-part-3-multiple-java-projects/ 
http://rominirani.com/2014/08/12/gradle-tutorial-part-4-java-web-applications/ 
http://grails.github.io/grails-gradle-plugin/docs/manual/guide/introduction.html 
http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608 
http://en.wikipedia.org/wiki/List_of_build_automation_software 
http://pygments.org/

More Related Content

What's hot

Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Corneil du Plessis
 
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersKostas Saidis
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developersTricode (part of Dept)
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with GradleWei Chen
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksMike Hugo
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradleLiviu Tudor
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...ZeroTurnaround
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 
Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Jared Burrows
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
Angular beans
Angular beansAngular beans
Angular beansBessem Hmidi
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best PracticesBurt Beckwith
 
Android gradle-build-system-overview
Android gradle-build-system-overviewAndroid gradle-build-system-overview
Android gradle-build-system-overviewKevin He
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeansRyan Cuprak
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
Maven
MavenMaven
Mavenfeng lee
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxAntoine Sabot-Durand
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by ExampleHsi-Kai Wang
 

What's hot (20)

Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!
 
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java Developers
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developers
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with Gradle
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 
Gradle
GradleGradle
Gradle
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradle
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Angular beans
Angular beansAngular beans
Angular beans
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best Practices
 
Android gradle-build-system-overview
Android gradle-build-system-overviewAndroid gradle-build-system-overview
Android gradle-build-system-overview
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
Maven
MavenMaven
Maven
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 

Similar to Build Systems Evolved: Intro to Gradle Build Tool

Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Ryan Cuprak
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan Cuprak
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build SystemJeevesh Pandey
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburgsimonscholz
 
OpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with GradleOpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with GradleAlkacon Software GmbH & Co. KG
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
Gradle notes
Gradle notesGradle notes
Gradle notesDum My
 
What's new in Gradle 4.0
What's new in Gradle 4.0What's new in Gradle 4.0
What's new in Gradle 4.0Eric Wendelin
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gatesStrannik_2013
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about GradleEvgeny Goldin
 
Eclipse Buildship DemoCamp Hamburg (June 2015) with additional screenshots
Eclipse Buildship DemoCamp Hamburg (June 2015)  with additional screenshotsEclipse Buildship DemoCamp Hamburg (June 2015)  with additional screenshots
Eclipse Buildship DemoCamp Hamburg (June 2015) with additional screenshotssimonscholz
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Tino Isnich
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Stfalcon Meetups
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forCorneil du Plessis
 

Similar to Build Systems Evolved: Intro to Gradle Build Tool (20)

Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
 
OpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with GradleOpenCms Days 2012 - Developing OpenCms with Gradle
OpenCms Days 2012 - Developing OpenCms with Gradle
 
Gradle
GradleGradle
Gradle
 
Why gradle
Why gradle Why gradle
Why gradle
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
Gradle : An introduction
Gradle : An introduction Gradle : An introduction
Gradle : An introduction
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Gradle notes
Gradle notesGradle notes
Gradle notes
 
What's new in Gradle 4.0
What's new in Gradle 4.0What's new in Gradle 4.0
What's new in Gradle 4.0
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gates
 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
 
Eclipse Buildship DemoCamp Hamburg (June 2015) with additional screenshots
Eclipse Buildship DemoCamp Hamburg (June 2015)  with additional screenshotsEclipse Buildship DemoCamp Hamburg (June 2015)  with additional screenshots
Eclipse Buildship DemoCamp Hamburg (June 2015) with additional screenshots
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01
 
Grails Spring Boot
Grails Spring BootGrails Spring Boot
Grails Spring Boot
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
 
GradleFX
GradleFXGradleFX
GradleFX
 

Recently uploaded

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 

Recently uploaded (20)

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂŽ Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 

Build Systems Evolved: Intro to Gradle Build Tool

  • 1. Gradle -­‐ Build system evolved By Bhagwat Kumar
  • 2. Agenda • What and Why? • Key features of Gradle • Project and tasks • Using java/groovy/war/jetty plugins • Manage dependency • Working with multi-­‐module project • Create grails application using Gradle 2
  • 3. What is Gradle? • A general-­‐purpose build automation tool. It can automate • building • testing • deployment • publishing • generate static websites • generate documentation • indeed anything else • Designed to take advantage of convention over configuration. • Combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. 3
  • 4. Why Gradle? • Powerful and expressive Groovy DSL instead of XML. • Adaptable to nonconventional project structures. • Works well for java as well as non java projects. • Extensible (plugins!). • Multi project builds are hassle free. • Powerful dependency management. • Reduced start up cost using Gradle daemon. • Caching of task input output. • Introduced to Android with Android Studio. • Grails 3.0 build system will be updated to use Gradle.
  • 5. Combines best features from other build tools. Image source : http://www.drdobbs.com/jvm/why-­‐build-­‐your-­‐java-­‐projects-­‐with-­‐gradle/240168608
  • 6. Features Image source : http://www.drdobbs.com/jvm/why-­‐build-­‐your-­‐java-­‐projects-­‐with-­‐gradle/240168608
  • 8. Installation Using gvm $ gvm install gradle $ gradle -­‐v $ gradle init $ gradle tasks Access gradle documentation from local file system {USER_HOME}/.gvm/gradle/current/docs/userguide/userguide.pdf
  • 9. Gradle Build Script • build.gradle file in project root directory. • Its actually a groovy script. • This is where you define gradle tasks. • Every Gradle build is made up of one or more projects. 9
  • 10. Gradle project • It does not necessarily represent a thing to be built. • It might represent a • library jar • web-­‐app • distribution zip assembled from the JARs produced by other projects • thing to be done : deploy to staging server 10
  • 11. Gradle Tasks • An atomic piece of work that a build performs. • compile classes • create jar • generate java doc • publish some archive to a repository • Each project is made up of one or more tasks 11
  • 12. build.gradle task hello << { Defines task 'hello' with groovy closure. println "Hello !!!!" } task greet <<{ println "Welocome Mr. Kumar" } task intro(dependsOn: hello) << { println "I'm Gradle" Defines task 'intro' which depends on 'hello' task appends additional groovy closure to be executed to existing 'hello' task } hello << { println "Hello extended!!!!" } greet.dependsOn hello, intro // gradle tasks :list all the available tasks // gradle intro :executes intro task // gradle -­‐q greet :bare build output // gradle -­‐-­‐daemon hello :subsequent execution will be fast gradle tasks are groovy objects. You can change dependency of existing tasks
  • 13. Using plugins • Gradle core intentionally provides very little for automation. • All of the useful features are added by plugins. e.g. java compile. • Gradle plugins • add new tasks (e.g. JavaCompile) • add domain objects (e.g. SourceSet) • add conventions (e.g. Java source is located at src/main/java) • extends core objects and objects from other plugins • Plugin portal : http://plugins.gradle.org/ 13
  • 14. Applying plugins 14 Script plugins //from a script on the local filesystem or at a remote location. apply from: 'other.gradle' Binary plugins // applying a binary plugin by type apply plugin: 'java' Using plugins DSL //version is optional plugins { id "com.jfrog.bintray" version "0.4.1" }
  • 15. Using java plugin • New/modified tasks • clean, compileJava, classes, jar, uploadArchives, build etc. • Default project layout • src/main/java • src/main/resources • src/test/java • Dependency configurations • compile, runtime, testCompile, archives etc. • Convention properties • sourceSets, sourceCompatibility, archivesBaseName etc. 15
  • 16. Changing project layout for java plugin 16 apply plugin: 'java' sourceSets { main { java { srcDirs = ['source/main/java'] } } test { java { srcDirs = ['source/test/java'] } } |-­‐-­‐ build.gradle |-­‐-­‐ settings.gradle `-­‐-­‐ source `-­‐-­‐ main `-­‐-­‐ java `-­‐-­‐ com `-­‐-­‐ intelligrape `-­‐-­‐ gradle `-­‐-­‐ Application.java package com.intelligrape.gradle.demo; public class Application { public static void main(String[] args) { System.out.println("Hello Gradle!!!"); } } Application.java
  • 17. A task to execute java class 17 build.gradle apply plugin: 'java' task runMe(type: JavaExec, dependsOn: 'classes') { main = "com.intelligrape.gradle.demo.Application" classpath = sourceSets.main.runtimeClasspath } Execute java class using 'runMe' task $ gradle -­‐q runMe Hello Gradle!!! Or execute using java command $ gradle -­‐q build $java -­‐cp build/classes/main com.intelligrape.gradle.demo.Application Hello Gradle!!!
  • 18. Configure jar manifest apply plugin: 'java' sourceCompatibility = 1.5 //controls jar file name version = '1.0-­‐snapshot' archivesBaseName="sample-­‐java" //self executable jar jar { manifest { attributes("Main-­‐Class": "com.intelligrape.manifest.Application", "Implementation-­‐Version": version) } } $ gradle -­‐q build $java -­‐jar build/lib/sample-­‐java-­‐1.0-­‐snapshot.jar Hello Gradle!!!
  • 19. Dependency management apply plugin: 'java' repositories { //mavenLocal() mavenCentral() //maven { url "http://repo.mycompany.com/maven2"} //flatDir { dirs 'lib1', 'lib2'} } dependencies { compile "org.quartz-­‐scheduler:quartz:2.1.5" testCompile group: 'junit', name: 'junit', version: '4.11' compile project(':shared') //project dependency runtime files('libs/a.jar', 'libs/b.jar') //file dependency }
  • 20. Working with groovy plugin • Groovy plugin extends the Java plugin to add support for Groovy projects. • It can deal with Groovy code, mixed Groovy and Java code, and even pure Java code. • New/modified tasks • compileGroovy, groovyDoc, classes etc • Project layout • src/main/groovy • src/test/groovy • You must add dependency for groovy • compile localGroovy() • compile 'org.codehaus.groovy:groovy-­‐all:2.3.6'
  • 21. build.gradle with groovy plugin apply plugin: 'groovy' repositories { mavenCentral() } dependencies { // compile localGroovy() compile 'org.codehaus.groovy:groovy-­‐all:2.3.6' } sourceSets { main { groovy { srcDirs = ['source/groovy'] } } test { groovy { srcDirs = ['source/groovy'] } } }
  • 22. Using war and jetty plugin apply plugin: "war" //gradle assemble //apply plugin: "jetty" //gradle jettyRun version = "1.0.0" archivesBaseName = "multi-­‐web" repositories { mavenCentral() } dependencies { compile project(":utils") compile "javax.servlet:servlet-­‐api:2.5" } |-­‐-­‐ build.gradle `-­‐-­‐ src `-­‐-­‐ main |-­‐-­‐ java | `-­‐-­‐ com | `-­‐-­‐ intelligrape | `-­‐-­‐ web | `-­‐-­‐ HomeServlet.java `-­‐-­‐ webapp |-­‐-­‐ WEB-­‐INF | `-­‐-­‐ web.xml `-­‐-­‐ index.jsp
  • 23. Working with multi-­‐project build.gradle 'hello' task is added to root as well as all the sub projects allprojects { task hello << { task -­‐> println "I'm $task.project.name" } } subprojects { Applied to only sub projects task onlySubProjectTask << { task -­‐> println "I'm $task.project.name" } apply plugin: "java" repositories { mavenCentral() } java plugin applied to all subproj Applied to only root project } task onlyMainProjectTask << { task -­‐> println "Only Main Project Task : ${task.project.name} " } multi-­‐project/ |-­‐-­‐ build.gradle |-­‐-­‐ settings.gradle |-­‐-­‐ top | `-­‐-­‐ build.gradle `-­‐-­‐ util `-­‐-­‐ build.gradle settings.gradle rootProject.name = 'multi-­‐project' include 'util', 'top'
  • 24. Working with multi-­‐project cont... Executing 'hello' task : executed for all projects $ gradle hello :hello I'm multi-­‐project :top:hello I'm top :util:hello I'm util Executing 'onlySubProjectTask' task : executed for only sub-­‐projects $ gradle onlySubProjectTask :top:onlySubProjectTask I'm top :util:onlySubProjectTask I'm util Execute hello task of 'top' sub-­‐project only $ gradle :top:hello :top:hello I'm top
  • 25. Using grails-­‐gradle plugin buildscript { repositories { jcenter() } dependencies {classpath "org.grails:grails-­‐gradle-­‐plugin:2.0.0"} } version "0.1" group "example" apply plugin: "grails" grails { grailsVersion = '2.3.6' springLoadedVersion '1.1.3' groovyVersion = '2.3.6' } repositories { //maven repo for the Grails Central repository (Core libraries and plugins) grails.central() } dependencies { // No container is deployed by default, so add this bootstrap "org.grails.plugins:tomcat:7.0.50" // Just an example of adding a Grails plugin compile 'org.grails.plugins:resources:1.2' }
  • 26. Using grails-­‐gradle plugin continued • Create build.gradle file and copy content from previous slide. • Execute 'gradle init' which will create file structure • To run app execute: • gradle gradle-­‐run-­‐app • The plugin configures a Gradle Task Rule to allow execution of any available Grails scripts as Gradle tasks. Simply prefix the Grails script name with grails-­‐ and execute from Gradle. • e.g. 'gradle grails-­‐refresh-­‐dependencies' • Passing arguments to Grails Tasks : • gradle -­‐PgrailsArgs="FooController" grails-­‐create-­‐controller • Setting the Grails Environment : • gradle -­‐PgrailsEnv=prod grails-­‐run-­‐app 26
  • 28. Thank you. 28 Blog: http://www.intelligrape.com/blog/author/bhagwat LikedIn: http://www.linkedin.com/in/bhagwatkumar Twitter: http://twitter.com/bhagwatkumar Mail : bhagwat@intelligrape.com
  • 29. References 29 http://www.gradle.org/docs/current/userguide/userguide_single.html http://www.gradle.org/docs/current/userguide/java_plugin.html http://www.gradle.org/docs/current/userguide/groovy_plugin.html http://plugins.gradle.org/ http://mrhaki.blogspot.in/2010/09/gradle-goodness-run-java-application.html http://mrhaki.blogspot.in/2009/11/using-gradle-for-mixed-java-and-groovy.html http://rominirani.com/2014/07/28/gradle-tutorial-part-1-installation-setup/ http://rominirani.com/2014/07/28/gradle-tutorial-part-2-java-projects/ http://rominirani.com/2014/07/29/gradle-tutorial-part-3-multiple-java-projects/ http://rominirani.com/2014/08/12/gradle-tutorial-part-4-java-web-applications/ http://grails.github.io/grails-gradle-plugin/docs/manual/guide/introduction.html http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608 http://en.wikipedia.org/wiki/List_of_build_automation_software http://pygments.org/