Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
How to create a company specific parent dependency in gradle

How to create a company specific parent dependency file which can be used across company specific gradle initiated projects

Sample libraries which I want to share across projects

dependencies {
    // logging
    implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
    implementation group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.7.30'

    // elasticsearch
    implementation group: 'org.elasticsearch', name: 'elasticsearch', version: '7.13.2'
    implementation group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '7.13.2'
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It depends on what is the goal of the parent POM? If it's only for the consolidation dependency versions, you can use a version catalog. A version catalog is a list of dependencies, represented as dependency coordinates, that a user can pick from when declaring dependencies in a build script.

settings.gradle

enableFeaturePreview('VERSION_CATALOGS')
dependencyResolutionManagement {
    versionCatalogs {
        libs {
            // logging
            alias('slf4j-api').to('org.slf4j:slf4j-api:1.7.30')
            alias('log4j-over-slf4j').to('org.slf4j:log4j-over-slf4j:1.7.30')

            // elasticsearch
            alias('elasticsearch').to('org.elasticsearch:elasticsearch:7.13.2')
            alias('elasticsearch-client').to('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.13.2')
            alias('elasticsearch-rest').to('org.elasticsearch.client:elasticsearch-rest-client:7.13.2')
        }
    }
}

build.gradle

dependencies {
    // logging
    implementation libs.slf4j.api
    implementation libs.log4j.over.slf4j

    // elasticsearch
    implementation libs.elasticsearch
    implementation libs.elasticsearch.client
    implementation libs.elasticsearch.rest
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!