@@ -23,19 +23,36 @@ class ArtifactoryPlugin implements Plugin<Project> {
23
23
24
24
private static final String ARTIFACTORY_URL_NAME = " ARTIFACTORY_URL"
25
25
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
+
26
32
private static final String DEFAULT_ARTIFACTORY_URL = " https://repo.spring.io"
27
33
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
+
28
40
@Override
29
41
void apply (Project project ) {
30
42
project. plugins. apply(' com.jfrog.artifactory' )
31
43
String name = Utils . getProjectName(project);
32
44
boolean isSnapshot = Utils . isSnapshot(project);
33
45
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 )
34
51
project. artifactory {
35
- contextUrl = System . getenv() . getOrDefault( ARTIFACTORY_URL_NAME , DEFAULT_ARTIFACTORY_URL )
52
+ contextUrl = artifactoryUrl
36
53
publish {
37
54
repository {
38
- repoKey = isSnapshot ? ' libs-snapshot-local ' : isMilestone ? ' libs-milestone-local ' : ' libs-release-local '
55
+ repoKey = isSnapshot ? snapshotRepository : isMilestone ? milestoneRepository : releaseRepository
39
56
if (project. hasProperty(' artifactoryUsername' )) {
40
57
username = artifactoryUsername
41
58
password = artifactoryPassword
0 commit comments