Skip to content

Commit

Permalink
Fix computation of sonatypeDefaultResolver for Sonatype Central
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Jul 26, 2024
1 parent 5abf84c commit 5f26fae
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/xerial/sbt/Sonatype.scala
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ object Sonatype extends AutoPlugin with LogSupport {
},
sonatypeDefaultResolver := {
if (sonatypeCredentialHost.value == SonatypeCentralClient.host) {
Resolver.url(s"https://$sonatypeCredentialHost")
Resolver.url(s"https://${sonatypeCredentialHost.value}")
} else {
val profileM = sonatypeTargetRepositoryProfile.?.value
val repository = sonatypeRepository.value
Expand Down
8 changes: 8 additions & 0 deletions src/sbt-test/sbt-sonatype/sonatype-central-host/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonatypeCredentialHost := xerial.sbt.sonatype.SonatypeCentralClient.host

val checkSonatypeDefaultResolver = taskKey[Unit]("Check if the default resolver is Sonatype")
checkSonatypeDefaultResolver := {
val actual = sonatypeDefaultResolver.value
val expected = Resolver.url("https://central.sonatype.com")
require(actual == expected, s"expected $actual to be $expected")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
throw new RuntimeException("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
else
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % pluginVersion)
}
1 change: 1 addition & 0 deletions src/sbt-test/sbt-sonatype/sonatype-central-host/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> checkSonatypeDefaultResolver

0 comments on commit 5f26fae

Please sign in to comment.