@@ -100,29 +100,29 @@ class SpringRepositoriesExtension {
100100 }
101101
102102 private void addRepositories (action ) {
103- addCommercialRepository(" release" , " /spring-enterprise-maven-prod-local" , action)
103+ addCommercialRepository(" release" , false , " /spring-enterprise-maven-prod-local" , action)
104104 if (this . version. contains(" -" )) {
105- addOssRepository(" milestone" , " /milestone" , action)
105+ addOssRepository(" milestone" , false , " /milestone" , action)
106106 }
107107 if (this . version. endsWith(" -SNAPSHOT" )) {
108- addCommercialRepository(" snapshot" , " /spring-enterprise-maven-dev-local" , action)
109- addOssRepository(" snapshot" , " /snapshot" , action)
108+ addCommercialRepository(" snapshot" , true , " /spring-enterprise-maven-dev-local" , action)
109+ addOssRepository(" snapshot" , true , " /snapshot" , action)
110110 }
111111 }
112112
113- private void addOssRepository (id , path , action ) {
113+ private void addOssRepository (id , snapshot , path , action ) {
114114 def name = " spring-oss-" + id
115115 def url = " https://repo.spring.io" + path
116- addRepository(name, url, action)
116+ addRepository(name, snapshot, url, action)
117117 }
118118
119- private void addCommercialRepository (id , path , action ) {
119+ private void addCommercialRepository (id , snapshot , path , action ) {
120120 if (! " commercial" . equalsIgnoreCase(this . buildType)) return
121121 def name = " spring-commercial-" + id
122122 def url = fromEnv(" COMMERCIAL_%SREPO_URL" , id, " https://usw1.packages.broadcom.com" + path)
123123 def username = fromEnv(" COMMERCIAL_%SREPO_USERNAME" , id)
124124 def password = fromEnv(" COMMERCIAL_%SREPO_PASSWORD" , id)
125- addRepository(name, url, { maven ->
125+ addRepository(name, snapshot, url, { maven ->
126126 maven. credentials { credentials ->
127127 credentials. setUsername(username)
128128 credentials. setPassword(password)
@@ -131,10 +131,17 @@ class SpringRepositoriesExtension {
131131 })
132132 }
133133
134- private void addRepository (name , url , action ) {
134+ private void addRepository (name , snapshot , url , action ) {
135135 this . repositories. maven { maven ->
136136 maven. setName(name)
137137 maven. setUrl(url)
138+ maven. content { content ->
139+ if (snapshot) {
140+ content. snapshotsOnly()
141+ } else {
142+ content. releasesOnly()
143+ }
144+ }
138145 action(maven)
139146 }
140147 }
0 commit comments