EnisZe
EnisZe

Reputation: 11

How do I structure the dependencies in a Gradle MultiModule Project?

So I am currently working on a multimodular spring boot application and I am using gradle as the built tool. So I have a main module which consists of the following:

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.1.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

group = 'ez.ndvz'
version = '0.0.1-SNAPSHOT'

java {
    sourceCompatibility = '17'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-test'

    implementation 'org.projectlombok:lombok'
}

tasks.named('test') {
    useJUnitPlatform()
}

And in the settings.gradle I have included my submodules. And now this is how my submodule build.gradle looks like:

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.1.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

java {
    sourceCompatibility = '17'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
    implementation 'org.projectlombok:lombok:1.18.26'
}

tasks.named('test') {
    useJUnitPlatform()
}

Right now as it is it works all fine but my question is since domain is the submodule shouldn't it inherit the parents dependencies and plugins? Everytime I try and remove the plugins the domain module won't work Shouldn't they be inherited from the parents module

Upvotes: 0

Views: 72

Answers (0)

Related Questions