SlideShare a Scribd company logo
1 of 23
Download to read offline
Gradle v.1.0
Andrii Khaisin
Provectus IT
27.07.2013
About me
Senior Software Developer
at Provectus IT
for Men's Wearhouse
Gradle in a few words
• Gradle is task oriented build tool.
• Gradle has a set of default plugins which
define conventions and standard life cycle of
project build.
• Gradle build scripts are Groovy scripts which
customize default workflow for your needs.
• Gradle works well for Java projects and for
non Java projects as well.
What we need from a build tool
• Ability to create and support build scripts
• Ability to define projects hierarchy for multi
module build
• Ability to manage project dependencies
• Ability to implement custom build logic
• Ability to extend available plugins
• Ability to develop new own plugins
• Ability to support build configurations
Lets some practice
• Projects structure
• Build running
• Groovy is everywhere
• Tasks
• Plugin usage
• Repositories
• Dependencies
• Custom plugin
Projects structure
• Project object model
• Convention over configuration
• Customize project model with build.gradle
• Split big scripts into parts
• Put submodule related script into separate
file or keep everything in one file.
Projects structure example
project/
api/
src/
build.gradle
data/
src/
war/
src/
main/
test/
build.gradle
settings.gradle
Build running
Gradle Installing approaches
• Locally installed Gradle distribution
• Gradle Wrapper - Keep it with you project
and wrapper solve all other tasks as Gradle
version, downloading Gradle and etc.
• GVM - Groovy enVironment Manager
Gradle launch
gradle <params> [task1, [task2, taks3, ...]]
Groovy is everywhere
• Gradle scripts are Groovy scripts
• Gradle works in JVM
• All Java world in your hands
Groovy is everywhere example
// Somewhere in build.gradle
def env = System.getenv();
System.getenv().each {
println it
}
def user = env['USER'];
if (user != null) {
println "User: $user";
}
Tasks
• Task is a named piece of work
• Tasks have relations between each other
• Tasks creates steps by step process of
project build
Tasks example
def env;
def user;
task prepareEnv << {
env = System.getenv();
}
task prepareUser (dependsOn:
'prepareEnv') << {
user = env['USER'];
}
task printEnv (dependsOn: 'prepareEnv') << {
env.each {
println it
}
}
task printUser (dependsOn: 'prepareUser' ) << {
if (user != null) {
println "User: $user";
}
}
Plugins usage
1. Declare that certain plugin will be used
apply plugin: 'java' – adds Java lifecircle
2. Configure properties of this plugin
3. Launch task defined by this plugin
Java plugin and its tasks
Java plugin define set of tasks and dependencies between
the. In the way there is create lifecircle similar to lifecircle
available in Maven
Repositories
repositories {
mavenLocal()
mavenCentral()
mavenRepo name: "lib", url:"libs"
mavenRepo url: "http://repo.company.com/maven"
ivy {
url "http://repo.company.com/ivy"
}
// Any custom defined source of artifacts
}
Dependencies
• Dependency is described by group, name, version and
other optional attributes
• Dependency types are configurable by plugins
• Java plugin adds compile, runtime, testCompile,
testRuntime
• Gradle support dependency version ranges
• transitive dependency management
Dependencies example
allprojects {
dependencies {
compile ''commons-collections:commons-collections:3.1''
testCompile group: 'junit', name: 'junit', version: '4.+'
}
}
project(':api') {
dependencies {
compile ''javax.xml.ws:jaxws-api:$wsVersion''
}
}
project(':server') {
dependencies {
runtime ''com.sun.xml.ws:jaxws-rt:$wsVersion''
}
}
Custom plugins and tasks
There are places where custom plugins could
be stored:
• build.gradle
• apply from: 'other.gradle'
• buildSrc folder which is automatically used
as a sources of additional scripts
• Remotelocal repositories
Custom plugins - buildSrc
buildSrc/ - Additional module with build script sources
src/
main/
groovy/
Wsdl2JavaPlugin.groovy
test/
build.gradle - more configuration if needed
api/
data/
server/
build.gradle
settings.gradle
Custom plugins - wsdl2java
def class Wsdl2JavaPlugin implements Plugin<Project> {
void apply(Project project) {
// Take configuration of WSDL file path
// Inject task in build life cycle
project.tasks.processResources.dependsOn Wsdl2JavaTask
// Generate sources and add theirs folder to Sources Set
}
}
// Then somewhere in the project
project(':api') {
apply plugin: 'wsdl2java'
wsdl2java src:"api/src/main/resources/wsdl/Service.wsdl"
}
Gradle is
• powerful
• simple
• compact
• evolving
• possible to debug
Gradle is just fun!
That's all :)
Links
Build tools
• http://www.gradle.org/
• http://buildr.apache.org/
• http://rubyforge.org/projects/rake
• http://ant.apache.org/
• http://maven.apache.org/
• http://www.gnu.org/software/make/
• http://www.cmake.org/

More Related Content

What's hot

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
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Eric Wendelin
 
Continuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsContinuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsHugo Josefson
 
"How to deploy to production 10 times a day" Андрей Шумада
"How to deploy to production 10 times a day" Андрей Шумада"How to deploy to production 10 times a day" Андрей Шумада
"How to deploy to production 10 times a day" Андрей ШумадаFwdays
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Build tools introduction
Build tools introductionBuild tools introduction
Build tools introductionvodQA
 
Jenkins Scriptler in 90mins
Jenkins Scriptler in 90minsJenkins Scriptler in 90mins
Jenkins Scriptler in 90minsLarry Cai
 
Jenkins Pipelining and Gatling Integration
Jenkins Pipelining and  Gatling IntegrationJenkins Pipelining and  Gatling Integration
Jenkins Pipelining and Gatling IntegrationKnoldus Inc.
 

What's hot (18)

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
 
Gradle
GradleGradle
Gradle
 
Gradle : An introduction
Gradle : An introduction Gradle : An introduction
Gradle : An introduction
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
Integration testing dropwizard
Integration testing dropwizardIntegration testing dropwizard
Integration testing dropwizard
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
Continuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsContinuous Integration with Maven for Android apps
Continuous Integration with Maven for Android apps
 
"How to deploy to production 10 times a day" Андрей Шумада
"How to deploy to production 10 times a day" Андрей Шумада"How to deploy to production 10 times a day" Андрей Шумада
"How to deploy to production 10 times a day" Андрей Шумада
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Build tools introduction
Build tools introductionBuild tools introduction
Build tools introduction
 
Jenkins Scriptler in 90mins
Jenkins Scriptler in 90minsJenkins Scriptler in 90mins
Jenkins Scriptler in 90mins
 
Jenkins Pipelining and Gatling Integration
Jenkins Pipelining and  Gatling IntegrationJenkins Pipelining and  Gatling Integration
Jenkins Pipelining and Gatling Integration
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Ant, Maven and Jenkins
Ant, Maven and JenkinsAnt, Maven and Jenkins
Ant, Maven and Jenkins
 
Report portal
Report portalReport portal
Report portal
 

Viewers also liked

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
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbookPascal Louis
 
Spring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepSpring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepGuo Albert
 
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
50 EJB 3 Best Practices in 50 Minutes - JavaOne 201450 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014Ryan Cuprak
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Ryan Cuprak
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaRyan Cuprak
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...SlideShare
 

Viewers also liked (8)

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]
 
Dev ecosystem v1.1
Dev ecosystem v1.1Dev ecosystem v1.1
Dev ecosystem v1.1
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbook
 
Spring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepSpring + JPA + DAO Step by Step
Spring + JPA + DAO Step by Step
 
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
50 EJB 3 Best Practices in 50 Minutes - JavaOne 201450 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
50 EJB 3 Best Practices in 50 Minutes - JavaOne 2014
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
 

Similar to Gradle

Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolvedBhagwat Kumar
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Andres Almiray
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan 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
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbtFabio Fumarola
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJSJohannes Weber
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to MavenEric Wyles
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundryrajdeep
 
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
 

Similar to Gradle (20)

Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
Oracle 12c Launch Event 02 ADF 12c and Maven in Jdeveloper / By Aino Andriessen
Oracle 12c Launch Event 02 ADF 12c and Maven in Jdeveloper / By Aino Andriessen Oracle 12c Launch Event 02 ADF 12c and Maven in Jdeveloper / By Aino Andriessen
Oracle 12c Launch Event 02 ADF 12c and Maven in Jdeveloper / By Aino Andriessen
 
tools cli java
tools cli javatools cli java
tools cli java
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
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
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJS
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
 
Maven
MavenMaven
Maven
 
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
 

Recently uploaded

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Gradle

  • 2. About me Senior Software Developer at Provectus IT for Men's Wearhouse
  • 3. Gradle in a few words • Gradle is task oriented build tool. • Gradle has a set of default plugins which define conventions and standard life cycle of project build. • Gradle build scripts are Groovy scripts which customize default workflow for your needs. • Gradle works well for Java projects and for non Java projects as well.
  • 4. What we need from a build tool • Ability to create and support build scripts • Ability to define projects hierarchy for multi module build • Ability to manage project dependencies • Ability to implement custom build logic • Ability to extend available plugins • Ability to develop new own plugins • Ability to support build configurations
  • 5. Lets some practice • Projects structure • Build running • Groovy is everywhere • Tasks • Plugin usage • Repositories • Dependencies • Custom plugin
  • 6. Projects structure • Project object model • Convention over configuration • Customize project model with build.gradle • Split big scripts into parts • Put submodule related script into separate file or keep everything in one file.
  • 8. Build running Gradle Installing approaches • Locally installed Gradle distribution • Gradle Wrapper - Keep it with you project and wrapper solve all other tasks as Gradle version, downloading Gradle and etc. • GVM - Groovy enVironment Manager Gradle launch gradle <params> [task1, [task2, taks3, ...]]
  • 9. Groovy is everywhere • Gradle scripts are Groovy scripts • Gradle works in JVM • All Java world in your hands
  • 10. Groovy is everywhere example // Somewhere in build.gradle def env = System.getenv(); System.getenv().each { println it } def user = env['USER']; if (user != null) { println "User: $user"; }
  • 11. Tasks • Task is a named piece of work • Tasks have relations between each other • Tasks creates steps by step process of project build
  • 12. Tasks example def env; def user; task prepareEnv << { env = System.getenv(); } task prepareUser (dependsOn: 'prepareEnv') << { user = env['USER']; } task printEnv (dependsOn: 'prepareEnv') << { env.each { println it } } task printUser (dependsOn: 'prepareUser' ) << { if (user != null) { println "User: $user"; } }
  • 13. Plugins usage 1. Declare that certain plugin will be used apply plugin: 'java' – adds Java lifecircle 2. Configure properties of this plugin 3. Launch task defined by this plugin
  • 14. Java plugin and its tasks Java plugin define set of tasks and dependencies between the. In the way there is create lifecircle similar to lifecircle available in Maven
  • 15. Repositories repositories { mavenLocal() mavenCentral() mavenRepo name: "lib", url:"libs" mavenRepo url: "http://repo.company.com/maven" ivy { url "http://repo.company.com/ivy" } // Any custom defined source of artifacts }
  • 16. Dependencies • Dependency is described by group, name, version and other optional attributes • Dependency types are configurable by plugins • Java plugin adds compile, runtime, testCompile, testRuntime • Gradle support dependency version ranges • transitive dependency management
  • 17. Dependencies example allprojects { dependencies { compile ''commons-collections:commons-collections:3.1'' testCompile group: 'junit', name: 'junit', version: '4.+' } } project(':api') { dependencies { compile ''javax.xml.ws:jaxws-api:$wsVersion'' } } project(':server') { dependencies { runtime ''com.sun.xml.ws:jaxws-rt:$wsVersion'' } }
  • 18. Custom plugins and tasks There are places where custom plugins could be stored: • build.gradle • apply from: 'other.gradle' • buildSrc folder which is automatically used as a sources of additional scripts • Remotelocal repositories
  • 19. Custom plugins - buildSrc buildSrc/ - Additional module with build script sources src/ main/ groovy/ Wsdl2JavaPlugin.groovy test/ build.gradle - more configuration if needed api/ data/ server/ build.gradle settings.gradle
  • 20. Custom plugins - wsdl2java def class Wsdl2JavaPlugin implements Plugin<Project> { void apply(Project project) { // Take configuration of WSDL file path // Inject task in build life cycle project.tasks.processResources.dependsOn Wsdl2JavaTask // Generate sources and add theirs folder to Sources Set } } // Then somewhere in the project project(':api') { apply plugin: 'wsdl2java' wsdl2java src:"api/src/main/resources/wsdl/Service.wsdl" }
  • 21. Gradle is • powerful • simple • compact • evolving • possible to debug Gradle is just fun!
  • 23. Links Build tools • http://www.gradle.org/ • http://buildr.apache.org/ • http://rubyforge.org/projects/rake • http://ant.apache.org/ • http://maven.apache.org/ • http://www.gnu.org/software/make/ • http://www.cmake.org/