Skip to content

Commit

Permalink
fix credentials setting
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k authored Aug 29, 2023
1 parent 50d765e commit a6651c3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ lazy val publishSetting = {
}
}

lazy val credentialsSetting = credentials += {
lazy val credentialsSetting = credentials ++= {
Seq("build.publish.user", "build.publish.password").map(k => Option(System.getProperty(k))) match {
case Seq(Some(user), Some(pass)) =>
Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass)
Seq(Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass))
case _ =>
Credentials(Path.userHome / ".ivy2" / ".credentials")
val x = Path.userHome / ".ivy2" / ".credentials"
if (x.exists) {
Seq(Credentials(x))
} else {
Nil
}
}
}

Expand Down

0 comments on commit a6651c3

Please sign in to comment.