SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
Why Gradle?
Gradle makes the impossible possible, the possible
easy and the easy elegant
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
apply plugin: 'java'
group = 'com.mycompany.app'
archivesBaseName = 'my-app'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.11'
}
Maven vs Gradle
Recognition by ThoughtWorks
“Two things have caused fatigue with XML-based build tools like Ant and Maven: too
many angry pointy braces and the coarseness of plug-in architectures. While syntax
issues can be dealt with through generation, plug-in architectures severely limit the
ability for build tools to grow gracefully as projects become more complex. We have
come to feel that plug-ins are the wrong level of abstraction, and prefer language-
based tools like Gradle and Rake instead, because they offer finer-grained abstrac-
tions and more flexibility long term.”
Gradle’s Compelling Feature Set
Convention over Configuration - Build Cycle
Ant was cool but it has maintainability issues, duplicated code.
Maven picks up and idea of convention over configuration. Repeated steps are
standardized. Maven’s core logic can be extended with plugins
Maven has life cyclye; Compile, unit and integration tests, assembling the
artifact, deploying the artifact to local repo, releasing the artifact to remote repo.
Dependency Management over maven central
Shortcomings - Maven “My way or Highway”
● Maven proposes a default structre and lifecycle for a project that often is
too restrictive
● Writing custom extensions for maven is hard. You must learn MOJO
● Plugin versions may be trouble for your environment.
Which one would you prefer?
Flexibility and extensibility but get weak project standardization, tons of
boilerplate code no support for dependency management by picking Ant;
Or You go with maven, which offers a convention over configuration approach
and a seamlessly integrated dependency manager, but an overly restrictive
mindset and cumbersome plugin system.
Or A build tool that offers you both like Gradle!
Here comes Gradle
Groovy instead of XML is
declerative, readable, and
it clearly express the
intention
What is possible with Gradle while it is impossible with others
Directed Acyclic Graph: In maven goals must depend on each other even if they have no dependencies, in gradle must not
Task Exclusion: In gradle you exclude any task from being run and all its dependend tasks
Task Ordering: Gradle supports shouldRunAfter, mustRunAfter operations
Task Dependency Inference: Gradle aware of what it produce. Any task that has java bin directory as input will automatically trigger compileJava.
True Multi Task Execution: You can specify multiple tasks when executing the build and no task in the resulting DAG is executed twice
Dry Run: Show tasks in which order without executing them Ex: gradle -m clean compile
Build automatically when sources change,
Declarative DSL
Integration With Other Build Tools
Gradle builds are 100%compatible with Maven and Ivy Repos. You can retrieve and publish your own artifacts. Also
Gradle provides converter for existing maven builds
Deployment Pipline
● Compile the code
● Runing unit and integration tests
● Performing static code analysis and generating test coverage
● Creating the distribution
● Provisioning the target environment
● Deploying the deliverable
● Performing smoke and automated functional tests
Let’s Get it Started
task helloWorld{
doLast {
println ‘Hello World’
}
}
task helloWorld<<{
println ‘Hello World’
}
task helloWorld{
doFirst{
‘Hello’
}
doLast{
‘World’
}
}
$ gradle -q helloWorld
Hello World!
def chant(){
ant.echo(message: ‘Hell Ant yeah!’)
}
3.times {
task “yayGradle$it” <<{
println ‘Gradle rocks’
}
}
yayGradle0.dependsOn startSession
yayGradle2.dependsOn yayGradle1, yayGradle0
task groupTherapy(dependsOn: yayGradle2)
$ #exclude task
$ gradle groupTherapy -x yayGradle0
$ #show all tasks
$ gradle -q tasks --all
Gradle Daemon
When using gradle day to day basis, you’ll find yourself having to run your build
repetitvely. Each time you initiate a build, the JVM has to be started, Gradle
dependency’s has to be loaded into class loader, and the project model has to be
constructed. This procedure usually takes 2 seconds.
Gradle daemon to the rescue!
$ ~/.gradle/gradle.properties
org.gradle.daemon=true
Let’s do some examples!
Dependency Management
Either one is available throu Gradle, Maven or Ivy Repositories
apply plugin: ‘java’
repositories {
mavenCentral()
mavenLocal()
maven {
url “http://dev.foreks.com/nexus/content/repositories/release
}
ivy {
url “http://repo.foreks.com/ivy/repo”
url “../local-repo”
}
}
dependencies{
compile ‘org.hibernate:hibernate-core:3.6.7.Final’
}
Dependency Configurations
Default configurations are compile, runtime, testCompile, testRuntime
configurations{
perfCompile
}
dependencies{
perfCompile(‘org.openjdk.jmh:jmh-core:1.11.2’,
‘org.openjdk.jmh:jmh-generator-bytecode:1.11.2’,
project)
compile ‘org.codehaus.groovy:groovy-all:2.4.4’
testCompile(‘junit:junit:4.+’, ‘org.spockframework:spock-core:1.0-groovy-2.4’)
testRuntime(‘com.athaydes:spock-reports:1.2.7’)
}
apply plugin: ‘eclipse’
eclipse {
classpath {
plusConfigurations+=[configurations.testCompile, configurations.
perfCompile]
}
}
Publishing artifacts
apply plugin: ‘maven’
uploadArchives{
repositories{
mavenDeployer{
repository(url: ‘ http://dev.foreks.com/nexus/content/repositories/releases ’){
authentication(userName:nexusUsername, passowrd:nexusPassword)
}
snapshotRepository(url: ‘ http://dev.foreks.com/nexus/content/repositories/snapshots ’){
authentication(userName:nexusUsername, password:nexusPassword)
}
}
}
}
Thanks

Contenu connexe

Tendances

Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenGeert Pante
 
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
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache MavenRajind Ruparathna
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with MavenSid Anand
 
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)Chen Cheng-Wei
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Introboyw165
 
Using Maven 2
Using Maven 2Using Maven 2
Using Maven 2andyhot
 
maven build certificaton
maven build certificatonmaven build certificaton
maven build certificatonVskills
 
When Web meet Native App
When Web meet Native AppWhen Web meet Native App
When Web meet Native AppYu-Wei Chuang
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 

Tendances (20)

Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in Maven
 
Maven
MavenMaven
Maven
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Maven 2 Introduction
Maven 2 IntroductionMaven 2 Introduction
Maven 2 Introduction
 
Maven
MavenMaven
Maven
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Maven
MavenMaven
Maven
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
 
Introduction to maven
Introduction to mavenIntroduction to maven
Introduction to maven
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
 
Using Maven 2
Using Maven 2Using Maven 2
Using Maven 2
 
maven build certificaton
maven build certificatonmaven build certificaton
maven build certificaton
 
When Web meet Native App
When Web meet Native AppWhen Web meet Native App
When Web meet Native App
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 

En vedette

Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavorTed Liang
 
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
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
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
 
Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Lemi Orhan Ergin
 

En vedette (12)

Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavor
 
Big Data on the Cloud
Big Data on the CloudBig Data on the Cloud
Big Data on the Cloud
 
Gradle
GradleGradle
Gradle
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
Gradle presentation
Gradle presentationGradle presentation
Gradle presentation
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Gradle
GradleGradle
Gradle
 
Gradle by Example
Gradle by ExampleGradle by Example
Gradle by Example
 
Gradle
GradleGradle
Gradle
 
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
 
Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016
 

Similaire à Why gradle

Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolvedBhagwat Kumar
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburgsimonscholz
 
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
 
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
 
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
 
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
 
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
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Max De Marzi
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
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
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another buildIgor Khotin
 
Gradle notes
Gradle notesGradle notes
Gradle notesDum My
 
Gradle(the innovation continues)
Gradle(the innovation continues)Gradle(the innovation continues)
Gradle(the innovation continues)Sejong Park
 
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
 
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
 

Similaire à Why gradle (20)

Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
 
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
 
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!
 
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)
 
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
 
Gradle : An introduction
Gradle : An introduction Gradle : An introduction
Gradle : An introduction
 
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
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
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
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
 
Enter the gradle
Enter the gradleEnter the gradle
Enter the gradle
 
Gradle notes
Gradle notesGradle notes
Gradle notes
 
Gradle
GradleGradle
Gradle
 
Gradle(the innovation continues)
Gradle(the innovation continues)Gradle(the innovation continues)
Gradle(the innovation continues)
 
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
 
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]
 

Dernier

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Why gradle

  • 1. Why Gradle? Gradle makes the impossible possible, the possible easy and the easy elegant
  • 3. Recognition by ThoughtWorks “Two things have caused fatigue with XML-based build tools like Ant and Maven: too many angry pointy braces and the coarseness of plug-in architectures. While syntax issues can be dealt with through generation, plug-in architectures severely limit the ability for build tools to grow gracefully as projects become more complex. We have come to feel that plug-ins are the wrong level of abstraction, and prefer language- based tools like Gradle and Rake instead, because they offer finer-grained abstrac- tions and more flexibility long term.”
  • 5. Convention over Configuration - Build Cycle Ant was cool but it has maintainability issues, duplicated code. Maven picks up and idea of convention over configuration. Repeated steps are standardized. Maven’s core logic can be extended with plugins Maven has life cyclye; Compile, unit and integration tests, assembling the artifact, deploying the artifact to local repo, releasing the artifact to remote repo. Dependency Management over maven central
  • 6. Shortcomings - Maven “My way or Highway” ● Maven proposes a default structre and lifecycle for a project that often is too restrictive ● Writing custom extensions for maven is hard. You must learn MOJO ● Plugin versions may be trouble for your environment.
  • 7. Which one would you prefer? Flexibility and extensibility but get weak project standardization, tons of boilerplate code no support for dependency management by picking Ant; Or You go with maven, which offers a convention over configuration approach and a seamlessly integrated dependency manager, but an overly restrictive mindset and cumbersome plugin system. Or A build tool that offers you both like Gradle!
  • 8. Here comes Gradle Groovy instead of XML is declerative, readable, and it clearly express the intention
  • 9. What is possible with Gradle while it is impossible with others Directed Acyclic Graph: In maven goals must depend on each other even if they have no dependencies, in gradle must not Task Exclusion: In gradle you exclude any task from being run and all its dependend tasks Task Ordering: Gradle supports shouldRunAfter, mustRunAfter operations Task Dependency Inference: Gradle aware of what it produce. Any task that has java bin directory as input will automatically trigger compileJava. True Multi Task Execution: You can specify multiple tasks when executing the build and no task in the resulting DAG is executed twice Dry Run: Show tasks in which order without executing them Ex: gradle -m clean compile Build automatically when sources change, Declarative DSL
  • 10. Integration With Other Build Tools Gradle builds are 100%compatible with Maven and Ivy Repos. You can retrieve and publish your own artifacts. Also Gradle provides converter for existing maven builds
  • 11. Deployment Pipline ● Compile the code ● Runing unit and integration tests ● Performing static code analysis and generating test coverage ● Creating the distribution ● Provisioning the target environment ● Deploying the deliverable ● Performing smoke and automated functional tests
  • 12. Let’s Get it Started task helloWorld{ doLast { println ‘Hello World’ } } task helloWorld<<{ println ‘Hello World’ } task helloWorld{ doFirst{ ‘Hello’ } doLast{ ‘World’ } } $ gradle -q helloWorld Hello World! def chant(){ ant.echo(message: ‘Hell Ant yeah!’) } 3.times { task “yayGradle$it” <<{ println ‘Gradle rocks’ } } yayGradle0.dependsOn startSession yayGradle2.dependsOn yayGradle1, yayGradle0 task groupTherapy(dependsOn: yayGradle2) $ #exclude task $ gradle groupTherapy -x yayGradle0 $ #show all tasks $ gradle -q tasks --all
  • 13. Gradle Daemon When using gradle day to day basis, you’ll find yourself having to run your build repetitvely. Each time you initiate a build, the JVM has to be started, Gradle dependency’s has to be loaded into class loader, and the project model has to be constructed. This procedure usually takes 2 seconds. Gradle daemon to the rescue! $ ~/.gradle/gradle.properties org.gradle.daemon=true
  • 14. Let’s do some examples!
  • 15. Dependency Management Either one is available throu Gradle, Maven or Ivy Repositories apply plugin: ‘java’ repositories { mavenCentral() mavenLocal() maven { url “http://dev.foreks.com/nexus/content/repositories/release } ivy { url “http://repo.foreks.com/ivy/repo” url “../local-repo” } } dependencies{ compile ‘org.hibernate:hibernate-core:3.6.7.Final’ }
  • 16. Dependency Configurations Default configurations are compile, runtime, testCompile, testRuntime configurations{ perfCompile } dependencies{ perfCompile(‘org.openjdk.jmh:jmh-core:1.11.2’, ‘org.openjdk.jmh:jmh-generator-bytecode:1.11.2’, project) compile ‘org.codehaus.groovy:groovy-all:2.4.4’ testCompile(‘junit:junit:4.+’, ‘org.spockframework:spock-core:1.0-groovy-2.4’) testRuntime(‘com.athaydes:spock-reports:1.2.7’) } apply plugin: ‘eclipse’ eclipse { classpath { plusConfigurations+=[configurations.testCompile, configurations. perfCompile] } }
  • 17. Publishing artifacts apply plugin: ‘maven’ uploadArchives{ repositories{ mavenDeployer{ repository(url: ‘ http://dev.foreks.com/nexus/content/repositories/releases ’){ authentication(userName:nexusUsername, passowrd:nexusPassword) } snapshotRepository(url: ‘ http://dev.foreks.com/nexus/content/repositories/snapshots ’){ authentication(userName:nexusUsername, password:nexusPassword) } } } }