question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

externalDependencyClasspath depending on managedClasspath in Runtime

See original GitHub issue

steps

Use an sbt-plugin such as sbt-web, and have the following included in your build.sbt

managedClasspath in Runtime += (packageBin in Assets).value

You can clone https://github.com/vmunier/akka-http-with-scalajs-example if you want a live example

Finally load the project in Intellij

problem

When using Intellij which resolves dependencies via sbt, Intellij runs the externalDependencyClasspath task to resolve the dependencies it needs. It appears that this task depends on managedClasspath in Runtime. Since plugins such as sbt-web compile Scala.js artifacts to managedClasspath in Runtime, this causes Intellij to do a scala-js fullOptJs when loading dependencies for such a project, taking easily 20+ minutes and sometimes causing Intellij to freeze

expectation

Need to clarify if externalDependencyClasspath should actually depend on managedClasspath in Runtime. According to @sjrd, managedClasspath in Compile should be enough to get the dependencies needed for the project. If externalDependencyClasspath depending on managedClasspath in Runtime is correct, then scala-js/sbt-web needs to re-evaluate how it uses sbt?

notes

Related ticket is https://github.com/sbt/sbt-web/issues/154 Also scala-js (ticket is closed) https://github.com/scala-js/scala-js/issues/3145

Also on Intellij bug tracker as https://youtrack.jetbrains.com/issue/SCL-12594

sbt version: 0.13.x

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:29 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
mdedetrichcommented, Sep 26, 2017

@eed3si9n Thanks a lot for the help, going to make an issue with akka-http-with-scalajs-example. It is also however mentioned on sbt-web, see https://github.com/sbt/sbt-web/blob/master/README.md#packaging-and-publishing

0reactions
eed3si9ncommented, Jan 4, 2020

The membership into Universal / packageBin is called Universal / mapping. sbt-native-packager populates it by using JavaAppPackaging (or “Java Application Archetype”).

https://github.com/sbt/sbt-native-packager/blob/v1.5.2/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala#L52-L64

    scriptClasspathOrdering += {
      val jar = (packageBin in Compile).value
      val id = projectID.value
      val art = (artifact in Compile in packageBin).value
      jar -> ("lib/" + makeJarName(id.organization, id.name, id.revision, art.name, art.classifier))
    },
    projectDependencyArtifacts := findProjectDependencyArtifacts.value,
    scriptClasspathOrdering ++= universalDepMappings(
      (dependencyClasspath in Runtime).value,
      projectDependencyArtifacts.value
    ),
    scriptClasspathOrdering := scriptClasspathOrdering.value.distinct,
    mappings in Universal ++= scriptClasspathOrdering.value,

If you need to stuff more files into the Universal / mappings ++= List(...) you can probably do that first from build.sbt, but it might be a good idea to define a custom archetype that extends JavaAppPackaging like JavaServerAppPackaging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessing managedClasspath of sbt subprojects
In sbt 0.11.x there is the task managedClasspath: ... Reverse dependencies: [info] compile:external-dependency-classpath [info] Delegates: ...
Read more >
sbt Reference Manual — Classpaths, sources, and resources
unmanagedClasspath; managedClasspath; externalDependencyClasspath ... project which uses a library that loads xxx.properties from classpath at run time.
Read more >
Download scalapb-runtime_sjs0.6_2.12.0-M2 JAR 0.5.16 With all ...
These are the files of the artifact scalapb-runtime_sjs0.6_2.12.0-M2 version 0.5.16 from the group com.trueaccord.scalapb. scalapb-runtime.
Read more >
The PlaySettings.scala Play Framework example source code
assets, compile, file, play, play framework, plugin, postcompile, runtime, sbt, ... def manageClasspath(config: Configuration) = managedClasspath in config ...
Read more >
playframework/playframework - Gitter
[debug] Previously invalidated, but (transitively) depend on new invalidations: [debug] Set() [debug] All newly invalidated classes after taking into ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found