From b9a4526bce051d06218385c0fea8c659bf3471d0 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 31 Dec 2012 11:30:36 -0500 Subject: [PATCH] fix credentials for publishing --- project/Release.scala | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/project/Release.scala b/project/Release.scala index a8865cf85..1d1aaf373 100644 --- a/project/Release.scala +++ b/project/Release.scala @@ -17,15 +17,19 @@ object Release extends Build lazy val pushWiki = TaskKey[Unit]("push-wiki") lazy val pushMain = TaskKey[Unit]("push-main") + val PublishRepoHost = "typesafe.artifactoryonline.com" + def settings(nonRoots: => Seq[ProjectReference], launcher: ScopedTask[File]): Seq[Setting[_]] = - (if(CredentialsFile.exists) releaseSettings(nonRoots, launcher) else Nil) ++ - (if(file(".release.sbt") exists) fullReleaseSettings else Nil) + if(CredentialsFile.exists) + releaseSettings(nonRoots, launcher) /* ++ fullReleaseSettings */ + else + Nil def releaseSettings(nonRoots: => Seq[ProjectReference], launcher: ScopedTask[File]): Seq[Setting[_]] = Seq( publishTo in ThisBuild <<= publishResolver, remoteID <<= publishStatus("typesafe-ivy-" + _), - credentials in Global += Credentials(CredentialsFile), - remoteBase <<= publishStatus( "https://typesafe.artifactoryonline.com/typesafe/ivy-" + _ ), + credentials in ThisBuild += Credentials(CredentialsFile), + remoteBase <<= publishStatus( "https://" + PublishRepoHost + "/typesafe/ivy-" + _ ), publishAllArtifacts <<= Util.inAll(nonRoots, publish.task), publishLauncher <<= deployLauncher(launcher), publishRelease <<= Seq(publishLauncher, publishAllArtifacts).dependOn, @@ -45,8 +49,10 @@ object Release extends Build } def getCredentials(cs: Seq[Credentials], log: Logger): (String, String) = { - val Some(creds) = Credentials.forHost(cs, "typesafe.artifactoryonline.com") - (creds.userName, creds.passwd) + Credentials.forHost(cs, PublishRepoHost) match { + case Some(creds) => (creds.userName, creds.passwd) + case None => error("No credentials defined for " + PublishRepoHost) + } } def snapshotPattern(version: String) = Resolver.localBasePattern.replaceAll("""\[revision\]""", version) def publishResolver: Project.Initialize[Option[Resolver]] = (remoteID, remoteBase) { (id, base) =>