Hello everyone! I'm trying to setup a Micronaut pr...
# gradle
x
Hello everyone! I'm trying to setup a Micronaut project with Gradle
6.4.0
, there are a lot of dependencies on different configurations (e.g.:
implementation
,
kapt
, etc.)...my question: is there a way to just include a BOM without the need to include it in all configurations? This is what I have:
Copy code
implementation(enforcedPlatform("io.micronaut:micronaut-bom:${project.property("micronaut.version")}"))

  kapt(enforcedPlatform("io.micronaut:micronaut-bom:${project.property("micronaut.version")}"))
  kaptTest(enforcedPlatform("io.micronaut:micronaut-bom:${project.property("micronaut.version")}"))

  testImplementation(enforcedPlatform("io.micronaut:micronaut-bom:${project.property("micronaut.version")}"))
...I would like just to have one of those applied to the entire project, if that's possible.
o
is
Copy code
configurations.all {
  add(name, enforcedPlatform("..."))
}
good enough?
🤔 1
c
Why didn't I think of that?
x
Does that work for you? Probably I'm doing something wrong, but it didn't work for me:
Copy code
configurations {
  all { add(enforcedPlatform("io.micronaut:micronaut-bom:${project.property("micronaut.version")}")) }
}
o
you forgot the
name
argument
and this assumes that it would be placed inside the
dependencies {}
block, apologies for not mentioning that
😅 1
x
Still, I need to add as many as configuration names I would like to support, right? If I add one with configuration name
implementation
it only applies to it,
kapt
doesn't know about it...
o
hmm? the point is that you iterate all the configurations, and
name
refers to each configuration's name
👌 1
Copy code
dependencies {
  configurations.all {
    add(name, enforcedPlatform("io.micronaut:micronaut-bom:${project.property("micronaut.version")}"))
  }
}
is the full thing that I am recommending, no substitutions required
👍 1
x
Probably I'm doing something wrong, I still get the same error in IDEA and the CLI:
Copy code
> Task :kaptGenerateStubsKotlin FAILED
Could not connect to Kotlin compile daemon
Could not connect to kotlin daemon. Using fallback strategy.
Error: Could not find or load main class org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.cli.jvm.K2JVMCompiler

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kaptGenerateStubsKotlin'.
o
I can't say for sure if that's related to the platform applying/not applying, you should probably look at the dependencies
x
Let me see...but looks like it might do the trick...thanks! 😎