Skip to content

Commit

Permalink
Merge pull request #137 from 2m/wix-snapshot-detection-2m
Browse files Browse the repository at this point in the history
Fix snapshot detection
  • Loading branch information
2m committed Jun 13, 2018
2 parents c110a2d + a0bb1e4 commit fdb28a8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions project/Publish.scala
Expand Up @@ -8,6 +8,7 @@ import sbt.Keys._
import java.io.File
import com.typesafe.sbt.pgp.PgpKeys
import com.typesafe.sbt.SbtPgp.autoImportImpl.pgpPassphrase
import sbtdynver.DynVerPlugin.autoImport._

object Publish extends AutoPlugin {

Expand All @@ -27,7 +28,8 @@ object Publish extends AutoPlugin {
homepage := Some(url("https://github.com/akka/akka-stream-contrib")),
publishMavenStyle := true,
pomIncludeRepository := { x => false },
defaultPublishTo := crossTarget.value / "repository"
defaultPublishTo := crossTarget.value / "repository",
ThisBuild / dynverSonatypeSnapshots := true,
)

def akkaPomExtra = {
Expand All @@ -46,13 +48,13 @@ object Publish extends AutoPlugin {
}

private def akkaPublishTo = Def.setting {
sonatypeRepo(version.value) orElse localRepo(defaultPublishTo.value)
sonatypeRepo(isSnapshot.value) orElse localRepo(defaultPublishTo.value)
}

private def sonatypeRepo(version: String): Option[Resolver] =
private def sonatypeRepo(isSnapshot: Boolean): Option[Resolver] =
Option(sys.props("publish.maven.central")) filter (_.toLowerCase == "true") map { _ =>
val nexus = "https://oss.sonatype.org/"
if (version endsWith "-SNAPSHOT") "snapshots" at nexus + "content/repositories/snapshots"
if (isSnapshot) "snapshots" at nexus + "content/repositories/snapshots"
else "releases" at nexus + "service/local/staging/deploy/maven2"
}

Expand Down

0 comments on commit fdb28a8

Please sign in to comment.