35
loading...
This website collects cookies to deliver better user experience
name := "some-module"
organization := "my.organization"
version := "1.0.0-SNAPSHOT"
scalaVersion := "2.12.2"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
libraryDependencies ++= Seq(
guice,
"com.rabbitmq" % "amqp-client" % "4.2.0",
"org.mockito" % "mockito-core" % "2.10.0" % "test"
)
val nexusHost = System.getenv("NEXUS_HOST")
val nexusUser = System.getenv("NEXUS_USER")
val nexusPassword = System.getenv("NEXUS_PASSWORD")
publishTo := {
val httpNexus = "http://" + nexusHost
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at httpNexus + "/repository/maven-snapshots")
else
Some("releases" at httpNexus + "/repository/maven-releases")
}
credentials += Credentials("Sonatype Nexus Repository Manager", nexusHost, nexusUser, nexusPassword)
sbt publish
and voilà! The module is published inside our own repository.libraryDependencies ++= Seq(
"my.organization" % "some-module" % "1.0.0-SNAPSHOT",
"com.rabbitmq" % "amqp-client" % "4.2.0"
)
resolvers += "My Snapshots" at "https://my.url/repository/maven-snapshots/"
credentials += Credentials("Sonatype Nexus Repository Manager", "my.url", nexusUser, nexusPassword)
sbt clean update
... And it fails miserably.https://my.url/repository/maven-snapshots/my/organization/some-module/1.0.0-SNAPSHOT/...
. But if you look carefully in your Nexus the module is actually at /my/organization/some-module_2.12/1.0.0-SNAPSHOT/...
. Notice this 2.12
? This is your Scala version, and this is actually quite important. So now, you're left with 3 choices.crossPaths := false
(highly NOT RECOMMENDED )some-module_2.12
instead of just some-module
%%
syntax to let SBT append this Scala version, which is the solution we choselibraryDependencies ++= Seq(
"my.organization" %% "some-module" % "1.0.0-SNAPSHOT",
"com.rabbitmq" % "amqp-client" % "4.2.0"
)
name := """my_service"""
organization := "my.organization"
version := "1.0"
packageName in Universal := "my_service"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.2"
val nexusUser = System.getenv("NEXUS_USER")
val nexusPassword = System.getenv("NEXUS_PASSWORD")
resolvers += "My Snapshots" at "https://my.url/repository/maven-snapshots/"
credentials += Credentials("Sonatype Nexus Repository Manager", "my.url", nexusUser, nexusPassword)
libraryDependencies ++= Seq(
guice,
"my.organization" %% "some-module" % "1.0.0-SNAPSHOT",
"com.rabbitmq" % "amqp-client" % "4.0.2"
)
scalaVersion
declaration, so here 2.12
.