Hi everyone! I'm new to Pulumi and was trying to g...
# getting-started
h
Hi everyone! I'm new to Pulumi and was trying to get it to work with sbt (I heard there is experimental support for it).
Copy code
Previewing update (dev)

View Live: <https://app.pulumi.com/JonSEng/ai-infra-test/dev/previews/2071fd20-eb30-47db-9c4c-08ef87af7701>

     Type                 Name               Plan     Info
     pulumi:pulumi:Stack  ...           1 error; 29 messages


Diagnostics:
  pulumi:pulumi:Stack (ai-infra-test-dev):
    [info] welcome to sbt 1.7.1 (JetBrains s.r.o Java 1.8.0_152-release)
...
    [error] /Users/.../ai/Job.scala:3:12: object pulumi is not a member of package com
    [error] import com.pulumi.Pulumi
    [error] (Compile / compileIncremental) Compilation failed
    [error] Total time: 25 s, completed 

    error: an unhandled error occurred: '/opt/homebrew/anaconda3/envs/it-ds/bin/sbt /opt/homebrew/anaconda3/envs/it-ds/bin/sbt -batch run' exited with non-zero exit code:
The code seems to compile fine locally though via
sbt
Copy code
sbt:pulumi-test> test:compile
[warn] sbt 0.13 shell syntax is deprecated; use slash syntax instead: Test / compile
[info] compiling 1 Scala source to /Users/...
[success] Total time: 3 s, completed
Any ideas on how to get
pulumi up
working with
sbt
? Our existing project is in
sbt
and
scala
so ideally we can create a new
sbt
subproject using pulumi to manage infra. Thanks!
m
I wrote a little Scale Pulumi program with sbt: I use sbt:
1.8.0
and Scala
3.2.1
and everything gets deployed. https://github.com/dirien/pulumi-scala-minecraft
h
Thanks @many-telephone-49025, I got it working off of your template. However, I wasn't able to get it to work as soon as I introduce sbt sub-projects. Anyone have advice on making pulumi work with sbt-subprojects within the same repo (the code isn't at the root level
repoRoot/src/...
but rather in a nested directory
repoRoot/sub-project-folder/src
.
It complains about compilation (false) errors. In sbt console and in IntelliJ I'm able to verify the code compiles fine. For example when using
sbt
sub-projects
Copy code
Diagnostics:
  pulumi:pulumi:Stack (infra-dev):
    [info] welcome to sbt 1.8.2 (Homebrew Java 19.0.2)
    [info] loading global plugins from...
.../src/main/scala/com/.../App.scala:53:85: ')' expected but ';' found.
    [error]           <http://ctx.log.info|ctx.log.info>(s"test: ${res.version()}");
    [error]