sbt-idea-plugin icon indicating copy to clipboard operation
sbt-idea-plugin copied to clipboard

IJ configurations are generated incorrectly if project name and lazy val name are different

Open mutcianm opened this issue 4 years ago • 1 comments

If when defining a top level plugin project one uses different names for the lazy val binding the project instance and name setting key, and then using a runner project to generate IJ artifact definitions and run configurations, the generated run configuration will reference a non-existing artifact as it's build dependency. This happens because when importing a project from SBT IJ uses lazy val's names to reference a module(project) and run configuration generator uses name key to reference an artifact. Example build with this issue:

lazy val IntellijPluginInScala = project.in(file("."))
  .enablePlugins(SbtIdeaPlugin)
  .settings(
    name := "myExample", // mind the name - it should be the same as lazy val name(or vice versa)
    version := "1.0-SNAPSHOT",
    libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.0",
    intellijPlugins += "org.intellij.scala::Nightly".toPlugin
  )

lazy val pluginRunner = createRunnerProject(IntellijPluginInScala)

mutcianm avatar Jul 14 '20 16:07 mutcianm

If when defining a top level plugin project one uses different names for the lazy val binding the project instance and name setting key, and then using a runner project to generate IJ artifact definitions and run configurations, the generated run configuration will reference a non-existing artifact as it's build dependency. This happens because when importing a project from SBT IJ uses lazy val's names to reference a module(project) and run configuration generator uses name key to reference an artifact. Example build with this issue:

lazy val IntellijPluginInScala = project.in(file("."))
  .enablePlugins(SbtIdeaPlugin)
  .settings(
    name := "myExample", // mind the name - it should be the same as lazy val name(or vice versa)
    version := "1.0-SNAPSHOT",
    libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.0",
    intellijPlugins += "org.intellij.scala::Nightly".toPlugin
  )

lazy val pluginRunner = createRunnerProject(IntellijPluginInScala)

Thana43 avatar Jun 05 '22 19:06 Thana43