Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can reStart support multiple dependency configurations? #116

Open
romanchelsea opened this issue Aug 20, 2024 · 2 comments
Open

Can reStart support multiple dependency configurations? #116

romanchelsea opened this issue Aug 20, 2024 · 2 comments

Comments

@romanchelsea
Copy link

romanchelsea commented Aug 20, 2024

Hi I'm relatively new to scala ecosystem.

I have reStart ("io.spray" % "sbt-revolver" % "0.10.0") configured in my project, and I would like to pass different javaOptions based on dependency configurations, e.g. Compile, Test, IntegrationTest, or even my custom configuration, like FuncTest (for functional tests).

If I'm reading the README correctly, reStart is just based on Compile, right?

I've been trying something like below, but my custom FuncTest configuration is not picking up a different logging configuration, i.e. logback.funcTest.xml, verified by checking the java process in shell.

// sbt.version = 1.7.1
// scala version = 2.13.8

lazy val FuncTest = config("run functional tests").extend(

lazy val hello = (project in file("."))
  .settings(
      // ... 
      reStart / mainClass := Some("com.example.MyApplication"),
      reStart / javaOptions ++= Seq(
        "-Dlogback.configurationFile=logback.development.xml",
      ),
      FuncTest / reStart / javaOptions ++= Seq(
        "-Dlogback.configurationFile=logback.funcTest.xml",
      )
   )

However, running below command in sbt shell works,

// in sbt shell
hello/reStart --- "-Dlogback.configurationFile=logback.funcTest.xml"

Would you please shed some light? Thanks!

@jrudolph
Copy link
Member

You are right. Other scopes than Compile are not supported out of the box. In fact, it's not even just Compile because it also has to take Runtime resources into account as well. I think that was the main blocker why I never tried to get anything else working (e.g. Test would be useful often as well). One would have to research how Compile and Runtime resources are used together for these kinds of things and then see how that would transfer to Test and even custom ones. I think your best bet could be to copy the whole RevolverPlugin.settings block into your build and try to adapt it to work with your custom scope.

@jrudolph
Copy link
Member

Btw. one question would be whether you really need run your tests or integrations test with sbt-revolver? Couldn't you just run them with test or run in which case just the normal config (without reStart bits) should work out-of-the-box?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants