JetBrains / sbt-idea-plugin

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

scala-library is getting bundled with libraryDependencies, even if bundleScalaLibrary is set to false #106

Closed moglideveloper closed 3 years ago

moglideveloper commented 3 years ago

If any libraryDepencies is used, then scala-library is also get bundled even when bundleScalaLibrary is set to false.

Below is the command that is used to package plugin :- sbt clean compile packageArtifact

Simplified project to reproduce this issue :- https://github.com/moglideveloper/SamplePlugin

build.sbt


name := "sample"

scalaVersion := "2.13.2"
ThisBuild / intellijPluginName := "LogicOverCode"
ThisBuild / intellijBuild := "211.7142.13"
ThisBuild / intellijPlatform := intellijPlatform.in(Global).??(IntelliJPlatform.IdeaCommunity).value
ThisBuild / bundleScalaLibrary  := false

intellijPlugins += "org.intellij.scala:2021.1.18".toPlugin

// scala library is coming with this dependency
libraryDependencies += "com.github.pathikrit" %% "better-files" % "3.9.1"

lazy val scalaIntellij = project.in(file("."))
  .enablePlugins(SbtIdeaPlugin)
mutcianm commented 3 years ago

This is actually related to https://github.com/sbt/sbt/issues/4632 scala-library is correctly added to "Provided" but still ends up in the "Compile" scope because it's a transitive dependency of "better-files" which is an expected sbt behaviour. I guess the only reasonable solution is to explicitly filter out all scala-library instances from the resulting classpath.