Skip to content

Commit 9564383

Browse files
committed
Merge branch '6.1.x' into 6.2.x
2 parents 674ce38 + a969f67 commit 9564383

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

buildSrc/src/main/groovy/io/spring/gradle/convention/ArtifactoryPlugin.groovy

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,36 @@ class ArtifactoryPlugin implements Plugin<Project> {
2323

2424
private static final String ARTIFACTORY_URL_NAME = "ARTIFACTORY_URL"
2525

26+
private static final String ARTIFACTORY_SNAPSHOT_REPOSITORY = "ARTIFACTORY_SNAPSHOT_REPOSITORY"
27+
28+
private static final String ARTIFACTORY_MILESTONE_REPOSITORY = "ARTIFACTORY_MILESTONE_REPOSITORY"
29+
30+
private static final String ARTIFACTORY_RELEASE_REPOSITORY = "ARTIFACTORY_RELEASE_REPOSITORY"
31+
2632
private static final String DEFAULT_ARTIFACTORY_URL = "https://repo.spring.io"
2733

34+
private static final String DEFAULT_ARTIFACTORY_SNAPSHOT_REPOSITORY = "libs-snapshot-local"
35+
36+
private static final String DEFAULT_ARTIFACTORY_MILESTONE_REPOSITORY = "libs-milestone-local"
37+
38+
private static final String DEFAULT_ARTIFACTORY_RELEASE_REPOSITORY = "libs-release-local"
39+
2840
@Override
2941
void apply(Project project) {
3042
project.plugins.apply('com.jfrog.artifactory')
3143
String name = Utils.getProjectName(project);
3244
boolean isSnapshot = Utils.isSnapshot(project);
3345
boolean isMilestone = Utils.isMilestone(project);
46+
Map<String, String> env = System.getenv()
47+
String artifactoryUrl = env.getOrDefault(ARTIFACTORY_URL_NAME, DEFAULT_ARTIFACTORY_URL)
48+
String snapshotRepository = env.getOrDefault(ARTIFACTORY_SNAPSHOT_REPOSITORY, DEFAULT_ARTIFACTORY_SNAPSHOT_REPOSITORY)
49+
String milestoneRepository = env.getOrDefault(ARTIFACTORY_MILESTONE_REPOSITORY, DEFAULT_ARTIFACTORY_MILESTONE_REPOSITORY)
50+
String releaseRepository = env.getOrDefault(ARTIFACTORY_RELEASE_REPOSITORY, DEFAULT_ARTIFACTORY_RELEASE_REPOSITORY)
3451
project.artifactory {
35-
contextUrl = System.getenv().getOrDefault(ARTIFACTORY_URL_NAME, DEFAULT_ARTIFACTORY_URL)
52+
contextUrl = artifactoryUrl
3653
publish {
3754
repository {
38-
repoKey = isSnapshot ? 'libs-snapshot-local' : isMilestone ? 'libs-milestone-local' : 'libs-release-local'
55+
repoKey = isSnapshot ? snapshotRepository : isMilestone ? milestoneRepository : releaseRepository
3956
if(project.hasProperty('artifactoryUsername')) {
4057
username = artifactoryUsername
4158
password = artifactoryPassword

0 commit comments

Comments
 (0)