JetBrains / sbt-idea-plugin

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

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

Open mutcianm opened 4 years ago

mutcianm commented 4 years ago

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 commented 2 years ago

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)