From 669ef3dfc3201fffa451b47d2b629a856afc0b25 Mon Sep 17 00:00:00 2001 From: Nikolay Tatarinov Date: Mon, 3 Oct 2016 20:19:27 +0300 Subject: Sonatype release plugin (#247) --- stage2/Publish.scala | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'stage2/Publish.scala') diff --git a/stage2/Publish.scala b/stage2/Publish.scala index 96e856b..7e00620 100644 --- a/stage2/Publish.scala +++ b/stage2/Publish.scala @@ -35,37 +35,15 @@ trait Publish extends PackageJars{ ) // ========== publish ========== - final protected val releaseFolder = s"/${groupId.replace(".","/")}/${artifactId}_$scalaMajorVersion/$version/" - private def snapshotUrl = new URL("https://oss.sonatype.org/content/repositories/snapshots") - private def releaseUrl = new URL("https://oss.sonatype.org/service/local/staging/deploy/maven2") - def publishUrl = if(version.endsWith("-SNAPSHOT")) snapshotUrl else releaseUrl - override def copy(context: Context) = super.copy(context).asInstanceOf[Publish] - - protected def sonatypeCredentials: Option[String] = { - // FIXME: this should probably not use cbtHome, but some reference to the system's host cbt - Some(new String(readAllBytes((context.cbtRootHome ++ "/sonatype.login").toPath)).trim) - } - - def publishSnapshot: Unit = { - copy( context.copy(version = Some(version+"-SNAPSHOT")) ).publishUnsigned - } + private val releaseFolder = s"/${groupId.replace(".","/")}/${artifactId}_$scalaMajorVersion/$version/" - def publishLocal: Unit = { + def publishLocal: Unit = lib.publishLocal( sourceFiles, `package` :+ pom, context.paths.mavenCache, releaseFolder ) - } - def publishSnapshotLocal: Unit = { + def publishSnapshotLocal: Unit = copy( context.copy(version = Some(version+"-SNAPSHOT")) ).publishLocal - } - def publishUnsigned: Unit = { - lib.publishUnsigned( - sourceFiles, `package` :+ pom, publishUrl ++ releaseFolder, sonatypeCredentials - ) - } - def publishSigned: Unit = { - lib.publishSigned( - sourceFiles, `package` :+ pom, publishUrl ++ releaseFolder, sonatypeCredentials - ) - } + def isSnapshot: Boolean = version.endsWith("-SNAPSHOT") + + override def copy(context: Context) = super.copy(context).asInstanceOf[Publish] } -- cgit v1.2.3