SlideShare a Scribd company logo
Headline
Gradle / Dependencies
Managing Dependencies with Gradle
Ads Engineering
Problem 1
● Managing dependencies in multi-module projects
TOP LEVEL
build.gradle
settings.gradle
Module A
build.gradle:
compile “netflix.platform:1.2”
Module B
build.gradle:
compile “netflix.platform:?”
Problem 1 -- cont’d
● Managing dependencies in multi-module projects
TOP LEVEL
build.gradle
settings.gradle
Module A
build.gradle:
compile “netflix.platform:1.2”
Module B
build.gradle:
compile “netflix.platform:1.2”
Problem 1 -- cont’d
● To update platform version to 2.3:
TOP LEVEL
build.gradle
settings.gradle
Module A
build.gradle:
compile “netflix.platform:2.3”
Module B
build.gradle:
compile “netflix.platform:2.3”
● Result: 2 edits …. or N edits!
Problem 1 -- Solution
● Use gradle.properties
TOP LEVEL
build.gradle
settings.gradle
gradle.properties
Problem 1 -- Solution -- cont’d
● What is it?
○ Normal Java properties file -- used to store module versions (amongst others):
gradle.properties
…
platformVersion=1.2
libraryXVersion=latest.release
...
● The values from the properties file can be referenced in build.gradle file:
build.gradle
…
compile “netflix:platform: $platformVersion”
compile “some:library: $libraryXVersion”
...
● Use the groovy string “ (double quotes not single)
Problem 1 -- Solution -- cont’d
● The versions can be referenced in all build.gradle files!
TOP LEVEL
build.gradle
settings.gradle
gradle.properties
Module A
build.gradle:
compile “netflix.platform:$platformVersion”
Module B
build.gradle:
compile “netflix.platform:$platformVersion”
…
platformVersion=1.2
libraryXVersion=latest.release
...
● One centralized place to change version numbers.
Problem 2
● Nebula promises repeatable immutable builds
● But!
// build.gradle snippet
...
compile “netflix:platform:latest.release”
…
Problem 2 -- cont’d
Day 1
platform.versions
● 1.1
● 1.2
latest.release -> 1.2
Build includes platform-1.2
Problem 2 -- cont’d
Day 1
platform.versions
● 1.1
● 1.2
latest.release -> 1.2
Day 2
platform.versions
● 1.1
● 1.2
● 1.3
latest.release -> 1.3
Build includes platform-1.3
Problem 2 -- cont’d
Day 1
platform.versions
● 1.1
● 1.2
latest.release -> 1.2
Day 2
platform.versions
● 1.1
● 1.2
● 1.3
latest.release -> 1.3
Day 3
platform.versions
● 1.1
● 1.2
● 1.3
● 2.0 (breaks binary compatibility)
latest.release -> 2.0
Build includes platform-2.0 (and fails!)
Problem 2 -- One Solution
● Pin version down
// build.gradle snippet
...
compile “netflix:platform:1.2”
…
Problem 2 -- One Solution -- cont’d
● Pin version down
// build.gradle snippet
...
compile “netflix:platform:1.2”
…
Problem: Have to manually update versions now every time there is a new
release. (Tedious and error-prone.)
Problem 2 -- nebula-dependency-lock Gradle Plugin
● Part of the Nebula gradle plugins family: https://github.com/nebula-
plugins/gradle-dependency-lock-plugin
A plugin to allow people using dynamic dependency versions to lock
them to specific versions.
● We can still use “latest.release” as the version number, but decide when the
version gets incremented, regardless of the versions of the components
available in the repository
● How?
● Creates a (JSON) “lock” file in the project directory with the current version
numbers.
● Lock file does NOT get updated during the normal build process -- so
versions are “locked” until the lock file is updated
● Provides Gradle tasks to update the lock file
● Committing the “lock” file into SCM (git/stash/etc) means building from the
commit (hash) at any time will use the same versions always
nebula-dependency-lock Gradle Plugin -- Cont’d
● Usage: simply reference the plugin in the build.gradle:
apply plugin: 'nebula.dependency-lock'
● Create a lock file:
gradle generateLock saveLock
Or (for multi-module projects)
gradle generateGlobalLock saveGlobalLock
(in root project)
nebula-dependency-lock Gradle Plugin -- Cont’d
● To update dependency graph (i.e. when new library gets added to
dependencies) -- but not update the versions!
gradle updateLock saveLock
Or
gradle updateGlobalLock saveGlobalLock
● In fact generateLock/updateLock and
generateGlobalLock/updateGlobalLock are equivalent so they can be
interchanged
○ Same command can be used in both cases
nebula-dependency-lock Gradle Plugin -- Cont’d
● To update versions
gradle updateLock saveLock --refresh-dependencies
Or
gradle updateGlobalLock saveGlobalLock --refresh-
dependencies
nebula-dependency-lock Gradle Plugin -- Cont’d
● More goodness: plugging in nebula gradle-scm-plugins
● What is it
○ Suite of Nebula plugins for interfacing with SCM (git/stash/etc)
○ On Github: https://github.com/nebula-plugins/gradle-scm-plugin
● Specialized plugins for each SCM
○ gradle-git-scm-plugin is the plugin for Stash/Git
○ On Github: https://github.com/nebula-plugins/gradle-git-scm-plugin
● Creates tasks for committing from build.gradle into Stash/Git
nebula-dependency-lock Gradle Plugin -- Cont’d
● When used in the same project with nebula-dependency-lock, a commitLock
task is created:
○ Commits the dependency “lock” file into SCM
○ For git/stash it does a commit + push (sync local/remote repos)
● Following updates the lock file and pushes it to the remote repository:
gradle updateLock saveLock commitLock --refresh-dependencies
Or
gradle updateGlobalLock saveGlobalLock commitLock --refresh-
dependencies
(Note the name of task is commitLock for both types of projects!)
nebula-dependency-lock Gradle Plugin -- Cont’d
Automatic nightly checked dependencies version upgrade:
● Everyone commits into master (assume we commit just code -- not update
dependencies too)
● Nightly, Jenkins job to:
a. gradle updateLock saveLock
b. gradle build test integrationTest
c. gradle commitLock
● Every morning the lock file will contain the latest versions which don’t break
the project!
■ Or if one of the new versions causes issues then you get notified by Jenkins!
nebula-dependency-lock Gradle Plugin -- Cont’d
● Multi-module or separate modules?
Problem 3
Module A Module B
libX:1.0
libY:2.0
libZ:3.0
Module A:
latest
libX:1.0
libY:2.0
TOP LEVEL
Module A
libX:1.0
libY:2.0
Module B
libZ:3.0
Module A
Problem 3 -- cont’d
Module A Module B
libX:1.0
libY:2.0
libZ:3.0
Module A:
latest
libX:1.0
libY:2.0
TOP LEVEL
Module A
libX:1.0
libY:2.0
Module B
libZ:3.0
Module A
Own Repo
Own Jenkins Job
Own Repo
Own Jenkins Job
One Repo
One Jenkins Job
Problem 3 -- cont’d
Module A Module B
libX:1.0
libY:latest
libZ:3.0
Module A:
latest
libX:1.0
libY:2.0
● Dependencies Update -- separate modules
libY:
● 2.0
● 2.1
libY:2.1
Artifactory
Module A: 1.1
Problem 3 -- cont’d
Module A Module B
libX:1.0
libY:latest
libZ:3.0
Module A:
1.1
libX:1.0
libY:2.1
● Dependencies Update -- separate modules
libY:
● 2.0
● 2.1
libY:2.1
Artifactory
Module A: 1.1
Problem 3 -- cont’d
Module A Module B
libX:1.0
libY:latest
libZ:3.0
Module A:
1.1
libX:1.0
libY:2.1
● Dependencies Update -- separate modules
libY:
● 2.0
● 2.1
libY:2.1
Artifactory
Module A: 1.1
CONFLICT!
(Only visible when
Module B gets
compiled)
Problem 3 -- cont’d
Solutions for conflict (separate modules):
● Go back to Module A and pin libY to version to 2.0
○ Requires changes in A + rebuild A
● Change Module B and force pin libY to version 2.0
○ Simply pin to 2.0 won’t work because Module A drags a new version (2.1)
○ Now Module A and B use different versions of libY (so any project using both of them will have
to force pin libY)
● Change Module B to exclude libY when pulling Module A
○ Will use whatever version Module B has for libY
○ Again, Module A and B use different versions
Problem 3 -- cont’d
Module B
libZ:3.0
Module A:
latest
libX:1.0
libY:latest
● Dependencies Update -- multi-modules
libY:
● 2.0
● 2.1
Artifactory
libY:2.1
Problem 3 -- cont’d
Module B
libZ:3.0
Module A:
latest
libX:1.0
libY:latest
● Dependencies Update -- multi-modules
libY:
● 2.0
● 2.1
Artifactory
libY:2.1
CONFLICT!
(Visible right away)
Problem 3 -- cont’d
Solutions for conflict (multi-module):
● Pin libY to version to 2.0
○ Requires one single change (in gradle.properties)
● Use dependency locking
○ The nightly build “catches” the incompatibility with 2.1 and doesn’t upgrade dependencies
Questions
?

More Related Content

What's hot

Git Grundlagen
Git GrundlagenGit Grundlagen
Git Grundlagen
Benjamin Schürmann
 
코틀린 멀티플랫폼, 미지와의 조우
코틀린 멀티플랫폼, 미지와의 조우코틀린 멀티플랫폼, 미지와의 조우
코틀린 멀티플랫폼, 미지와의 조우
Arawn Park
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
GoogleDevelopersStud1
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
Safique Ahmed Faruque
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
Anwarul Islam
 
Versionskontrolle mit Git
Versionskontrolle mit GitVersionskontrolle mit Git
Versionskontrolle mit Git
NETUserGroupBern
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
Youssef Mohammed Abohaty
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
Mohammad Imam Hossain
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Houari ZEGAI
 
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideEvolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Victor Rentea
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Roland Emmanuel Salunga
 
Curl Tutorial
Curl Tutorial Curl Tutorial
Curl Tutorial
Ankireddy Polu
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Angular
AngularAngular
Clean Code - The Next Chapter
Clean Code - The Next ChapterClean Code - The Next Chapter
Clean Code - The Next Chapter
Victor Rentea
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
Tzar Umang
 
Présentation de git
Présentation de gitPrésentation de git
Présentation de git
Julien Blin
 

What's hot (20)

Git real slides
Git real slidesGit real slides
Git real slides
 
Git Grundlagen
Git GrundlagenGit Grundlagen
Git Grundlagen
 
코틀린 멀티플랫폼, 미지와의 조우
코틀린 멀티플랫폼, 미지와의 조우코틀린 멀티플랫폼, 미지와의 조우
코틀린 멀티플랫폼, 미지와의 조우
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Versionskontrolle mit Git
Versionskontrolle mit GitVersionskontrolle mit Git
Versionskontrolle mit Git
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideEvolving a Clean, Pragmatic Architecture - A Craftsman's Guide
Evolving a Clean, Pragmatic Architecture - A Craftsman's Guide
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Curl Tutorial
Curl Tutorial Curl Tutorial
Curl Tutorial
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Angular
AngularAngular
Angular
 
Clean Code - The Next Chapter
Clean Code - The Next ChapterClean Code - The Next Chapter
Clean Code - The Next Chapter
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
Présentation de git
Présentation de gitPrésentation de git
Présentation de git
 

Viewers also liked

Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014
Justin Ryan
 
Protista
ProtistaProtista
Protista
xempat
 
NWC Resume
NWC ResumeNWC Resume
NWC Resume
John Stone
 
Progress in chhattisgarh
Progress in chhattisgarhProgress in chhattisgarh
Progress in chhattisgarh
rajpalnegi
 
Fungi
FungiFungi
Fungi
xempat
 
Pertumbuhan dan perkembangan
Pertumbuhan dan perkembanganPertumbuhan dan perkembangan
Pertumbuhan dan perkembangan
xempat
 
Diapositivas.
Diapositivas.Diapositivas.
Diapositivas.
Andrea Jackeline
 
Builder pattern vs constructor
Builder pattern vs constructorBuilder pattern vs constructor
Builder pattern vs constructor
Liviu Tudor
 
Sistem ekskresi
Sistem ekskresiSistem ekskresi
Sistem ekskresi
xempat
 
Sistem pernapasan
Sistem pernapasanSistem pernapasan
Sistem pernapasan
xempat
 

Viewers also liked (12)

Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014Netflix Nebula - Gradle Summit 2014
Netflix Nebula - Gradle Summit 2014
 
Protista
ProtistaProtista
Protista
 
NWC Resume
NWC ResumeNWC Resume
NWC Resume
 
Progress in chhattisgarh
Progress in chhattisgarhProgress in chhattisgarh
Progress in chhattisgarh
 
NANOTEHNOLOGIJA U MEDICINI
NANOTEHNOLOGIJA U MEDICININANOTEHNOLOGIJA U MEDICINI
NANOTEHNOLOGIJA U MEDICINI
 
Fungi
FungiFungi
Fungi
 
Pertumbuhan dan perkembangan
Pertumbuhan dan perkembanganPertumbuhan dan perkembangan
Pertumbuhan dan perkembangan
 
Diapositivas.
Diapositivas.Diapositivas.
Diapositivas.
 
Itchayada_Klorvutisatian_visualcv_resume
Itchayada_Klorvutisatian_visualcv_resumeItchayada_Klorvutisatian_visualcv_resume
Itchayada_Klorvutisatian_visualcv_resume
 
Builder pattern vs constructor
Builder pattern vs constructorBuilder pattern vs constructor
Builder pattern vs constructor
 
Sistem ekskresi
Sistem ekskresiSistem ekskresi
Sistem ekskresi
 
Sistem pernapasan
Sistem pernapasanSistem pernapasan
Sistem pernapasan
 

Similar to Managing dependencies with gradle

Mono Repo
Mono RepoMono Repo
Mono Repo
Zacky Pickholz
 
Developing with versioning and CI/CD
Developing with versioning and CI/CDDeveloping with versioning and CI/CD
Developing with versioning and CI/CD
Matteo Di Carlo
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
nuppla
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
NexThoughts Technologies
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
Git introduction
Git introductionGit introduction
Git introduction
sppmg
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
OlinData
 
Gradle: One technology to build them all
Gradle: One technology to build them allGradle: One technology to build them all
Gradle: One technology to build them all
Bonitasoft
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Microservices Development Process at Predix.io
Microservices Development Process at Predix.ioMicroservices Development Process at Predix.io
Microservices Development Process at Predix.io
Constantine Grigel
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow Workshop
Syed Imam
 
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
 
How to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applicationsHow to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applications
takezoe
 
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
sparkfabrik
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for developmentGerrit Wanderer
 
GitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by ScalaGitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by Scala
takezoe
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
RDO and Ceph meetup BCN - Testing in RDO
RDO and Ceph meetup BCN - Testing in RDORDO and Ceph meetup BCN - Testing in RDO
RDO and Ceph meetup BCN - Testing in RDO
Alfredo Moralejo
 
Automated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build ServiceAutomated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build Service
Dani Llewellyn
 

Similar to Managing dependencies with gradle (20)

Mono Repo
Mono RepoMono Repo
Mono Repo
 
Developing with versioning and CI/CD
Developing with versioning and CI/CDDeveloping with versioning and CI/CD
Developing with versioning and CI/CD
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git introduction
Git introductionGit introduction
Git introduction
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Gradle: One technology to build them all
Gradle: One technology to build them allGradle: One technology to build them all
Gradle: One technology to build them all
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Microservices Development Process at Predix.io
Microservices Development Process at Predix.ioMicroservices Development Process at Predix.io
Microservices Development Process at Predix.io
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow Workshop
 
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]
 
How to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applicationsHow to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applications
 
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
 
GitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by ScalaGitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by Scala
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
RDO and Ceph meetup BCN - Testing in RDO
RDO and Ceph meetup BCN - Testing in RDORDO and Ceph meetup BCN - Testing in RDO
RDO and Ceph meetup BCN - Testing in RDO
 
Automated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build ServiceAutomated Snap Package build processes without the Build Service
Automated Snap Package build processes without the Build Service
 

Recently uploaded

Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 

Recently uploaded (20)

Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 

Managing dependencies with gradle

  • 1. Headline Gradle / Dependencies Managing Dependencies with Gradle Ads Engineering
  • 2. Problem 1 ● Managing dependencies in multi-module projects TOP LEVEL build.gradle settings.gradle Module A build.gradle: compile “netflix.platform:1.2” Module B build.gradle: compile “netflix.platform:?”
  • 3. Problem 1 -- cont’d ● Managing dependencies in multi-module projects TOP LEVEL build.gradle settings.gradle Module A build.gradle: compile “netflix.platform:1.2” Module B build.gradle: compile “netflix.platform:1.2”
  • 4. Problem 1 -- cont’d ● To update platform version to 2.3: TOP LEVEL build.gradle settings.gradle Module A build.gradle: compile “netflix.platform:2.3” Module B build.gradle: compile “netflix.platform:2.3” ● Result: 2 edits …. or N edits!
  • 5. Problem 1 -- Solution ● Use gradle.properties TOP LEVEL build.gradle settings.gradle gradle.properties
  • 6. Problem 1 -- Solution -- cont’d ● What is it? ○ Normal Java properties file -- used to store module versions (amongst others): gradle.properties … platformVersion=1.2 libraryXVersion=latest.release ... ● The values from the properties file can be referenced in build.gradle file: build.gradle … compile “netflix:platform: $platformVersion” compile “some:library: $libraryXVersion” ... ● Use the groovy string “ (double quotes not single)
  • 7. Problem 1 -- Solution -- cont’d ● The versions can be referenced in all build.gradle files! TOP LEVEL build.gradle settings.gradle gradle.properties Module A build.gradle: compile “netflix.platform:$platformVersion” Module B build.gradle: compile “netflix.platform:$platformVersion” … platformVersion=1.2 libraryXVersion=latest.release ... ● One centralized place to change version numbers.
  • 8. Problem 2 ● Nebula promises repeatable immutable builds ● But! // build.gradle snippet ... compile “netflix:platform:latest.release” …
  • 9. Problem 2 -- cont’d Day 1 platform.versions ● 1.1 ● 1.2 latest.release -> 1.2 Build includes platform-1.2
  • 10. Problem 2 -- cont’d Day 1 platform.versions ● 1.1 ● 1.2 latest.release -> 1.2 Day 2 platform.versions ● 1.1 ● 1.2 ● 1.3 latest.release -> 1.3 Build includes platform-1.3
  • 11. Problem 2 -- cont’d Day 1 platform.versions ● 1.1 ● 1.2 latest.release -> 1.2 Day 2 platform.versions ● 1.1 ● 1.2 ● 1.3 latest.release -> 1.3 Day 3 platform.versions ● 1.1 ● 1.2 ● 1.3 ● 2.0 (breaks binary compatibility) latest.release -> 2.0 Build includes platform-2.0 (and fails!)
  • 12. Problem 2 -- One Solution ● Pin version down // build.gradle snippet ... compile “netflix:platform:1.2” …
  • 13. Problem 2 -- One Solution -- cont’d ● Pin version down // build.gradle snippet ... compile “netflix:platform:1.2” … Problem: Have to manually update versions now every time there is a new release. (Tedious and error-prone.)
  • 14. Problem 2 -- nebula-dependency-lock Gradle Plugin ● Part of the Nebula gradle plugins family: https://github.com/nebula- plugins/gradle-dependency-lock-plugin A plugin to allow people using dynamic dependency versions to lock them to specific versions. ● We can still use “latest.release” as the version number, but decide when the version gets incremented, regardless of the versions of the components available in the repository
  • 15. ● How? ● Creates a (JSON) “lock” file in the project directory with the current version numbers. ● Lock file does NOT get updated during the normal build process -- so versions are “locked” until the lock file is updated ● Provides Gradle tasks to update the lock file ● Committing the “lock” file into SCM (git/stash/etc) means building from the commit (hash) at any time will use the same versions always nebula-dependency-lock Gradle Plugin -- Cont’d
  • 16. ● Usage: simply reference the plugin in the build.gradle: apply plugin: 'nebula.dependency-lock' ● Create a lock file: gradle generateLock saveLock Or (for multi-module projects) gradle generateGlobalLock saveGlobalLock (in root project) nebula-dependency-lock Gradle Plugin -- Cont’d
  • 17. ● To update dependency graph (i.e. when new library gets added to dependencies) -- but not update the versions! gradle updateLock saveLock Or gradle updateGlobalLock saveGlobalLock ● In fact generateLock/updateLock and generateGlobalLock/updateGlobalLock are equivalent so they can be interchanged ○ Same command can be used in both cases nebula-dependency-lock Gradle Plugin -- Cont’d
  • 18. ● To update versions gradle updateLock saveLock --refresh-dependencies Or gradle updateGlobalLock saveGlobalLock --refresh- dependencies nebula-dependency-lock Gradle Plugin -- Cont’d
  • 19. ● More goodness: plugging in nebula gradle-scm-plugins ● What is it ○ Suite of Nebula plugins for interfacing with SCM (git/stash/etc) ○ On Github: https://github.com/nebula-plugins/gradle-scm-plugin ● Specialized plugins for each SCM ○ gradle-git-scm-plugin is the plugin for Stash/Git ○ On Github: https://github.com/nebula-plugins/gradle-git-scm-plugin ● Creates tasks for committing from build.gradle into Stash/Git nebula-dependency-lock Gradle Plugin -- Cont’d
  • 20. ● When used in the same project with nebula-dependency-lock, a commitLock task is created: ○ Commits the dependency “lock” file into SCM ○ For git/stash it does a commit + push (sync local/remote repos) ● Following updates the lock file and pushes it to the remote repository: gradle updateLock saveLock commitLock --refresh-dependencies Or gradle updateGlobalLock saveGlobalLock commitLock --refresh- dependencies (Note the name of task is commitLock for both types of projects!) nebula-dependency-lock Gradle Plugin -- Cont’d
  • 21. Automatic nightly checked dependencies version upgrade: ● Everyone commits into master (assume we commit just code -- not update dependencies too) ● Nightly, Jenkins job to: a. gradle updateLock saveLock b. gradle build test integrationTest c. gradle commitLock ● Every morning the lock file will contain the latest versions which don’t break the project! ■ Or if one of the new versions causes issues then you get notified by Jenkins! nebula-dependency-lock Gradle Plugin -- Cont’d
  • 22. ● Multi-module or separate modules? Problem 3 Module A Module B libX:1.0 libY:2.0 libZ:3.0 Module A: latest libX:1.0 libY:2.0 TOP LEVEL Module A libX:1.0 libY:2.0 Module B libZ:3.0 Module A
  • 23. Problem 3 -- cont’d Module A Module B libX:1.0 libY:2.0 libZ:3.0 Module A: latest libX:1.0 libY:2.0 TOP LEVEL Module A libX:1.0 libY:2.0 Module B libZ:3.0 Module A Own Repo Own Jenkins Job Own Repo Own Jenkins Job One Repo One Jenkins Job
  • 24. Problem 3 -- cont’d Module A Module B libX:1.0 libY:latest libZ:3.0 Module A: latest libX:1.0 libY:2.0 ● Dependencies Update -- separate modules libY: ● 2.0 ● 2.1 libY:2.1 Artifactory Module A: 1.1
  • 25. Problem 3 -- cont’d Module A Module B libX:1.0 libY:latest libZ:3.0 Module A: 1.1 libX:1.0 libY:2.1 ● Dependencies Update -- separate modules libY: ● 2.0 ● 2.1 libY:2.1 Artifactory Module A: 1.1
  • 26. Problem 3 -- cont’d Module A Module B libX:1.0 libY:latest libZ:3.0 Module A: 1.1 libX:1.0 libY:2.1 ● Dependencies Update -- separate modules libY: ● 2.0 ● 2.1 libY:2.1 Artifactory Module A: 1.1 CONFLICT! (Only visible when Module B gets compiled)
  • 27. Problem 3 -- cont’d Solutions for conflict (separate modules): ● Go back to Module A and pin libY to version to 2.0 ○ Requires changes in A + rebuild A ● Change Module B and force pin libY to version 2.0 ○ Simply pin to 2.0 won’t work because Module A drags a new version (2.1) ○ Now Module A and B use different versions of libY (so any project using both of them will have to force pin libY) ● Change Module B to exclude libY when pulling Module A ○ Will use whatever version Module B has for libY ○ Again, Module A and B use different versions
  • 28. Problem 3 -- cont’d Module B libZ:3.0 Module A: latest libX:1.0 libY:latest ● Dependencies Update -- multi-modules libY: ● 2.0 ● 2.1 Artifactory libY:2.1
  • 29. Problem 3 -- cont’d Module B libZ:3.0 Module A: latest libX:1.0 libY:latest ● Dependencies Update -- multi-modules libY: ● 2.0 ● 2.1 Artifactory libY:2.1 CONFLICT! (Visible right away)
  • 30. Problem 3 -- cont’d Solutions for conflict (multi-module): ● Pin libY to version to 2.0 ○ Requires one single change (in gradle.properties) ● Use dependency locking ○ The nightly build “catches” the incompatibility with 2.1 and doesn’t upgrade dependencies