Hey have anyone figured out how to use pulumi with...
# java
h
Hey have anyone figured out how to use pulumi with java and gradle with a multi module setup?
f
running into any particular issues?
or just not sure where to start?
h
yeah so a bit of both. I envision having a single repo with a multimodule gradle project
Copy code
rootProject.name = "pulumi"
include(
    "libs:modules",
    "services:app-cluster",
    "services:mgmt-cluster",
    "testing:commons",
)
👍 1
I think the issue is that it runs gradle local to each service so its not picking up general stuff thats defined in the root project
f
like is it not picking up a pulumi config file?
h
E.g. im using https://docs.gradle.org/current/userguide/platforms.html, a toml file where i define versions and refer them in the projects as
Copy code
dependencies {
    implementation(libs.groovy.core)
}
And this just fails as it cant resolve it
Also using
buildSrc
which also doesnt work to refer in the
build.gradle
file inside of the services folder
I believe its because its running just
gradle
locally from the folder instead of actually invoking gradle with the service from the root of the repository, i.e.
gradle :services:app-cluster
The dir structure (simplified):
Copy code
settings.gradle
build.gradle
services/
  -> app-cluster/
       * build.gradle
       * Pulumi.yaml
       * Pulumi.dev.yaml
       * Pulumi.staging.yaml
       * Pulumi.production.yaml
   -> mgmt-cluster/
       * build.gradle
       * Pulumi.yaml
       * Pulumi.dev.yaml
       * Pulumi.staging.yaml
       * Pulumi.production.yaml
e
I’d be interested in making this work could you file an issue? It’d be a relatively simple change to teach
pulumi-language-java
how to invoke gradle from the right folder and with the right args.
f
So I'm still in pulumi python land, but one thing we're doing is running everything through a separate wrapper script that sets some env vars and points to the appropriate command line. One thing you could maybe do is create a cradle task that executes the pulumi cli with appropriate args and from the appropriate directory
h
Yeah sure ill create an issue 🙂
Let me know if you need me to try anything out, would love to get this working so we can migrate from typescript and have everything in kotlin
👍 1