Sbt: Removing '_2.12' from artifactId when deploying



I hope this is not too bad of a first question. I recently tried to deploy an early version of a library that I’m writing (in scala) to maven central. It deployed ok but it seems that the project name is postfixed with ‘_2.12’

I found a stack overflow post which says adding the following line of code to build.sbt but it hasn’t seemed to have helped.

crossPaths := false

Can you please help me get rid of this?


Is the postfix causing any problems?

I don’t know how to remove it, but the Scala version is appended for a reason: the different versions are not binary compatible. So if someone uses your library in a project built against 2.11 or 2.13, it may not work for them.
Build tools with proper scala support hide the suffix when specifying dependencies, e.g. in sbt, the double %% in dependencies instructs it to look for a version matching the build, so users of your library will probably never see the suffix:

scalaVersion := "2.12.6"

libraryDependencies += "org.example" %% "my-lib" % "1.0"
// equivalent to
libraryDependencies += "org.example" % "my-lib_2.12" % "1.0"

If the scalaVersion was set to a different minor, e.g. 2.11, the dependency would not be resolved, if you did not deploy a version built against 2.11.

If your library is written in Scala and intended to be used from Scala, you should probably not remove the suffix.