Need help to understand why in this case Gradle cannot find my module

I want to import my ‘Projet_Modelisation_logiciel.main’ module into my ClientApp module but it failed:

This is my project structure :

[![Screen of my Intellij project][1]][1]

In this Project I already imported ‘Api.main’ into my ‘Project_Modelisation_logiciel.main’ using ‘maven-publish’

So I try to do the same thing.

Here is my ‘Projet_Modelisation_logiciel’ build.gradle :

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.10'
    id 'org.beryx.jlink' version '2.24.1'

    id 'org.springframework.boot' version '2.6.3'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'

    id 'maven-publish'
}
apply plugin: 'java-library'

group 'be.ac.umons.g03.Common_class'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

ext {
    junitVersion = '5.8.1'
}

sourceCompatibility = '11'
targetCompatibility = '11'

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

javafx {
    version = '11.0.2'
    modules = ['javafx.controls', 'javafx.fxml', 'javafx.web']
}

dependencies {

    implementation 'be.ac.umons.g03.api:API:1.0-SNAPSHOT'

    implementation('org.controlsfx:controlsfx:11.1.0')
    implementation('com.dlsc.formsfx:formsfx-core:11.3.2') {
        exclude(group: 'org.openjfx')
    }
    implementation('net.synedra:validatorfx:0.1.13') {
        exclude(group: 'org.openjfx')
    }
    implementation('org.kordamp.ikonli:ikonli-javafx:12.2.0')
    implementation('org.kordamp.bootstrapfx:bootstrapfx-core:0.4.0')
    implementation('eu.hansolo:tilesfx:11.48') {
        exclude(group: 'org.openjfx')
    }
    implementation group: 'io.github.cdimascio', name: 'dotenv-java', version: '2.2.0'


    implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.3'
    implementation 'org.springframework:spring-web:5.3.15'


    testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")

    testImplementation 'org.mockito:mockito-inline:4.3.1'
    testImplementation 'org.mockito:mockito-junit-jupiter:4.3.1'
}

test {
    useJUnitPlatform()
}

jlink {
    imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip")
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'app'
    }
}

jlinkZip {
    group = 'distribution'
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId 'be.ac.umons.g03.Common_class'
            artifactId 'Main'
            version '1.0-SNAPSHOT'

            from components.java
        }
    }
}

Here is my ‘ClientApp’ settings.gradle :

rootProject.name = "ClientApp"
include ':be.ac.umons.g03.Common_class'

So I add this line in my ‘ClientApp’ build.gradle dependencies :

implementation 'be.ac.umons.g03.Common_class:Main:1.0-SNAPSHOT'

When I try to build my ‘ClientApp’ dependencies I got this :

+--- be.ac.umons.g03.Common_class:Main:1.0-SNAPSHOT FAILED

I used the same logic for my Api module (you can see the ‘implementation’ in my build.gradle → first dependency) and it works, I don’t figure out why it’s not working in this case.
[1]: https://i.stack.imgur.com/pXnVf.png

include ':be.ac.umons.g03.Common_class' includes a subproject of name be.ac.umons.g03.Common_class in a folder with that name.
What you want is to use a composite build by doing instead includeBuild '..'.

1 Like