JetBrains / sbt-idea-plugin

Develop IntelliJ plugins with Scala and SBT
Apache License 2.0
98 stars 28 forks source link

Scala library is not bundled when the plugin is defined as a nested project #133

Open odisseus opened 11 hours ago

odisseus commented 11 hours ago

Steps to reproduce

  1. Download and extract the example project: plugin-repo.zip
  2. Run sbt clean packageArtifact.
  3. Check the contents of myAwesomePlugin/target/plugin directory. It will contain the JAR with the plugin code (and the dependency JARs if you add any), but the scala-library dependency will be missing.
  4. Run sbt runIDE and open any project. You will get a classloader error. The message can sometimes be quite obscure, but it is always caused by the missing Scala library.
  5. For comparison, re-define the project so that its base directory is in . (this can be done by uncommenting a few lines in build.sbt. After running sbt clean packageArtifact, observe that the target/plugin directory contains both the plugin JAR and the Scala library.

Adding ThisBuild / bundleScalaLibrary := true doesn't seem to have any effect.

This issue might be related to #106.

vasilmkd commented 10 hours ago

Hi there, thanks for the report. https://github.com/JetBrains/sbt-idea-plugin/blob/08613ec76f951cee6989ab2b97a6d4467feb1f82/packaging/src/main/scala/org/jetbrains/sbtidea/packaging/PackagingKeysInit.scala#L23 You can experiment with setting packageLibraryMappings := Seq.empty, or adjusting the default values. Mapping to None means that the library dependency will be ignored in the final output.