JetBrains / sbt-idea-plugin

Develop IntelliJ plugins with Scala and SBT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mutcianm opened this issue · 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)

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)