https://pulumi.com logo
#java
Title
# java
h

hundreds-airport-37168

05/06/2022, 4:07 PM
Hey have anyone figured out how to use pulumi with java and gradle with a multi module setup?
f

freezing-van-87649

05/06/2022, 5:09 PM
running into any particular issues?
or just not sure where to start?
h

hundreds-airport-37168

05/06/2022, 5:10 PM
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

freezing-van-87649

05/06/2022, 5:11 PM
like is it not picking up a pulumi config file?
h

hundreds-airport-37168

05/06/2022, 5:12 PM
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

enough-garden-22763

05/06/2022, 9:16 PM
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

freezing-van-87649

05/06/2022, 10:04 PM
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

hundreds-airport-37168

05/09/2022, 6:53 AM
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
7 Views