I am struggling to execute gradle tasks from a subproject when using buildSrc.
The project structure looks like this:
root
buildSrc
src
main
kotlin
Dependencies.kt
build.gradle.kts
soa
SoaProject1
settings.gradle.kts
build.gradle.kts
SoaProject2
settings.gradle.kts
build.gradle.kts
tools
ToolProject1
ToolProject2
settings.gradle.kts
build.gradle.kts
The root settings.gradle.kts looks like this:
include(
":SoaProject1",
":SoaProject2"
)
project(":SoaProject1").projectDir = File("soa/SoaProject1")
project(":SoaProject2").projectDir = File("soa/SoaProject2")
In one of the build.gradle.kts files of a SoaProject e.g. I have following dependency:
dependencies {
implementation("log4j:log4j:${Versions.log4j}")
}
Importing/Refreshing gradle projects is working in Intellij and the dependencies get downloaded. But when I try to execute a gradle task from the subproject I get an unresolved reference Versions error.
The Dependencies.kt contains the Versions class and it looks like this:
object Versions {
const val log4j = "1.2.16"
}
So to me it looks like gradle can find the dependencies and the Versions class but for some reason the tasks of the subproject don't have access to the buildSrc?
Does anyone have any hint what might be missing or what I can try?
Thank you for your help!
Regards Simon