Skip to content

Commit

Permalink
Don't configure sonatype repo if another repository is already config…
Browse files Browse the repository at this point in the history
…ured (#853)

Motivation:

For cases when publishing repositories are configured by the environment
we should not configure sonatype repo.

Modifications:

- Configure `sonatype` publishing repo only if no other repos are
configured;
- Name for this `sonatype` repo;

Result:

`sonatype` publishing repo will be configured only if there are no other
repos.
  • Loading branch information
idelpivnitskiy authored Nov 8, 2019
1 parent 96e3e19 commit 1364258
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ final class ServiceTalkLibraryPlugin extends ServiceTalkCorePlugin {
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = project.isReleaseBuild ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_TOKEN")

if (!repositories) {
repositories {
maven {
name = "sonatype"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = project.isReleaseBuild ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_TOKEN")
}
}
}
}
Expand Down

0 comments on commit 1364258

Please sign in to comment.