How to create a Maven parent POM equivalent in gradle?

(Vignesh Shanmugam) #1

I have a Common parent in maven having just as a pom packaging which uses a common dependency creates by me.
Now I need the Common parent in Gradle.
Is it possible to have a similar structure using gradle ?

(davidmichaelkarr) #2

When you have a Gradle multiproject build structure, the top-level build.gradle is where you would put things like this. Read the “Multi-project Builds” chapter in the user guide.

(Vignesh Shanmugam) #3

I tried to use gradle init command for the below pom, but it is throwing error that could not convert maven pom to gradle build. I am not able to identify the issue.

<?xml version="1.0" encoding="UTF-8"?>



<description>Demo project for Coreload-Parent</description>




	<!-- -->


(uklance) #4

Your objective can likely be solved via a subprojects closure in the root project


subprojects {
    apply plugin: 'java' 
    dependencies {
        compile 'foo:bar:1.0'

Once your project inevitably grows and you want to deal with a subset of projects you can

[':project1', ':project2'].each {
    project(it) {
        dependencies {
            compile 'foo:bar:1.0'


subprojects.find {'foo') }.each { project -> 
    project.dependencies {
        compile 'foo:bar:1.0'

(Vignesh Shanmugam) #5

Thank you very much.

(Jiri Svatos) #6

Sorry, but I think, that question is little different. We have many modular application and many a many modules (let say 10 OSGi application and 200 bundles). I dont think so, that multiproject build is suitable. Let say 80% of bundles (1 bundle = 1 project) are shared in many application.

(Jiri Svatos) #7

Could I have 1 “subproject” in many “top project”? How?

(uklance) #8

I’m not sure I understand the question, can you give a bit more info?