javakotlingradlecomposite

Gradle Composite Project: "Could not resolve" even with correct paths


When loading a composite project in gradle there is the error:

Could not resolve de.demo.project.
Required by:
    project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

settings.gradle.kts:

rootProject.name = "demoname"

includeBuild("../other-demo-project")

gradle file:

....
dependencies {
    implementation(group = "de.demo", name = "other-demo-project")
}
....

Paths are setup correctly even, if they aren't there is a could not find error.


Solution

  • Fixed it myself already, so answering for anyone in need and to save hours of frustration.

    It was caused by a java.sourceCompatibility = JavaVersion.VERSION_1_8 in the parent project, that was missing in the child project.

    after adding that everything worked as it should.