From 573e99315fe22db032115b614403de80148f155a Mon Sep 17 00:00:00 2001 From: Andres Pipicello Date: Thu, 23 May 2019 22:43:33 -0300 Subject: Fixes generation of fake SBT libraries --- scalalib/src/GenIdeaImpl.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scalalib/src/GenIdeaImpl.scala b/scalalib/src/GenIdeaImpl.scala index 84ec26fc..8c72f0bd 100755 --- a/scalalib/src/GenIdeaImpl.scala +++ b/scalalib/src/GenIdeaImpl.scala @@ -226,12 +226,16 @@ object GenIdeaImpl { def sbtLibraryNameFromPom(pom : os.Path) : String = { val xml = scala.xml.XML.loadFile(pom.toIO) - val groupId = (xml \ "groupId").text + val parent = xml \ "parent" val artifactId = (xml \ "artifactId").text - val version = (xml \ "version").text + val groupId = Some(xml \ "groupId").filter(_.nonEmpty).getOrElse(parent \ "groupId").text + val version = Some(xml \ "version").filter(_.nonEmpty).getOrElse(parent \ "version").text - // The scala version here is non incidental - s"SBT: $groupId:$artifactId:$version:jar" + val artifactWithScalaVersion = artifactId.substring(artifactId.length - 5) match { + case "_2.10" | "_2.11" | "_2.12" => artifactId + case _ => artifactId + "_2.12" + } + s"SBT: $groupId:$artifactWithScalaVersion:$version:jar" } def libraryName(resolvedJar: ResolvedLibrary) : String = resolvedJar match { -- cgit v1.2.3