mirror of https://github.com/sbt/sbt.git
Only warn on missing credential file
This commit is contained in:
parent
dba6225ac1
commit
f7020fd0ad
|
|
@ -457,12 +457,24 @@ object Tasks {
|
|||
val useSbtCredentials = coursierUseSbtCredentials.value
|
||||
|
||||
val authenticationByHost =
|
||||
if (useSbtCredentials) {
|
||||
val cred = sbt.Keys.credentials.value.map(sbt.Credentials.toDirect)
|
||||
cred.map { c =>
|
||||
c.host -> Authentication(c.userName, c.passwd)
|
||||
}.toMap
|
||||
} else
|
||||
if (useSbtCredentials)
|
||||
sbt.Keys.credentials
|
||||
.value
|
||||
.flatMap {
|
||||
case dc: sbt.DirectCredentials => List(dc)
|
||||
case fc: sbt.FileCredentials =>
|
||||
sbt.Credentials.loadCredentials(fc.path) match {
|
||||
case Left(err) =>
|
||||
log.warn(s"$err, ignoring it")
|
||||
Nil
|
||||
case Right(dc) => List(dc)
|
||||
}
|
||||
}
|
||||
.map { c =>
|
||||
c.host -> Authentication(c.userName, c.passwd)
|
||||
}
|
||||
.toMap
|
||||
else
|
||||
Map.empty[String, Authentication]
|
||||
|
||||
val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
scalaVersion := "2.11.8"
|
||||
credentials += Credentials(file("nope/nope/nope/nope/nope"))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
val pluginVersion = sys.props.getOrElse(
|
||||
"plugin.version",
|
||||
throw new RuntimeException(
|
||||
"""|The system property 'plugin.version' is not defined.
|
||||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
|
||||
)
|
||||
)
|
||||
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
object Main extends App
|
||||
|
|
@ -0,0 +1 @@
|
|||
> update
|
||||
Loading…
Reference in New Issue