diff --git a/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala b/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala index 87a593f..2e4f8fd 100644 --- a/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala +++ b/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala @@ -158,9 +158,10 @@ object ScalafmtPlugin extends AutoPlugin { val repositories = resolvers.collect { case r: MavenRepository => r.root } - val repoCredentials = credentials.map { x => - val cred = Credentials.toDirect(x) - new RepositoryCredential(cred.host, cred.userName, cred.passwd) + val repoCredentials = credentials.flatMap { c => + Try(Credentials.toDirect(c)).toOption.map { dc => + new RepositoryCredential(dc.host, dc.userName, dc.passwd) + } } log.debug(