From 9ff26c81241a37d01cc2773a08ee06dab0b0762c Mon Sep 17 00:00:00 2001 From: Douglas Thomsen Date: Wed, 21 Aug 2024 15:22:31 -0600 Subject: [PATCH] Update error message. --- .../scala/codeartifact/CodeArtifactKeys.scala | 3 +++ .../codeartifact/CodeArtifactPlugin.scala | 23 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala index 34dab0a..7d8f65f 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactKeys.scala @@ -31,6 +31,9 @@ trait InternalCodeArtifactKeys { val codeArtifactToken = taskKey[Option[String]]( "CodeArtifact authentication. Provided by environment variable CODEARTIFACT_AUTH_TOKEN or fetched dynamically from available AWS credentials." ) + + val codeArtifactGetTokenInstructions = + taskKey[Option[String]]("Instructions on how to get a token for CodeArtifact") } object CodeArtifactKeys extends CodeArtifactKeys diff --git a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala index cdb25e6..47c0fa0 100644 --- a/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala +++ b/sbt-codeartifact/src/main/scala/codeartifact/CodeArtifactPlugin.scala @@ -43,7 +43,28 @@ object CodeArtifactPlugin extends AutoPlugin { ), credentials ++= { val token = codeArtifactToken.value.getOrElse { - streams.value.log.warn("Unable to get AWS CodeArtifact auth token.") + streams.value.log.warn( + """ + | ___ ______ ____ _ _ _ _ __ _ + | / \ \ / / ___| / ___|___ __| | ___ / \ _ __| |_(_)/ _| __ _ ___| |_ + | / _ \ \ /\ / /\___ \ | | / _ \ / _` |/ _ \ / _ \ | '__| __| | |_ / _` |/ __| __| + | / ___ \ V V / ___) | | |__| (_) | (_| | __// ___ \| | | |_| | _| (_| | (__| |_ + |/_/ \_\_/\_/ |____/ \____\___/ \__,_|\___/_/ \_\_| \__|_|_| \__,_|\___|\__| + | + | + |The AWS CodeArtifact sbt plugin was not able to get a valid auth token. If you recieve and error due to + |the a dependency not being found then it could be caused by this. + | + |""".stripMargin + ) + + codeArtifactGetTokenInstructions.value.foreach { instructions => + streams.value.log.warn( + s""" + | ${instructions} + |""".stripMargin + ) + } "" } val repos = codeArtifactRepo.value +: codeArtifactResolvers.value