Skip to content

Commit 6742c95

Browse files
authored
Remove Apache Snapshots from release builds (#313)
This PR: - Limits the usage of `repository.apache.org` to artifacts in the `org.apache.logging` group. - Uses the Snapshots repository only if `log4j.repository.url` is not specified or empty.
1 parent 90a071c commit 6742c95

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

settings.gradle

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,19 @@ dependencyResolutionManagement {
2626
repositories {
2727
google()
2828
mavenCentral()
29+
// Points to the correct Apache staging repository
30+
var apacheSnapshots = 'https://repository.apache.org/snapshots'
31+
var repositoryUrl = providers.gradleProperty('log4j.repository.url')
32+
.filter { !it.isEmpty() }
33+
.getOrElse(apacheSnapshots)
2934
maven {
30-
name = 'Apache Snapshots Repository'
31-
url = "https://repository.apache.org/snapshots"
35+
name = 'Log4j Repository'
36+
url = repositoryUrl
3237
mavenContent {
33-
snapshotsOnly()
34-
}
35-
}
36-
// Points to the correct Apache staging repository
37-
//
38-
// See gradle.properties
39-
var repositoryUrl = providers.gradleProperty("log4j.repository.url")
40-
if (repositoryUrl != null && !repositoryUrl.toString().isEmpty()) {
41-
maven {
42-
name = 'Apache Repository'
43-
url = repositoryUrl
44-
mavenContent {
45-
releasesOnly()
46-
}
38+
// Only use this repository for Apache Logging Services artifacts
39+
includeGroupAndSubgroups('org.apache.logging')
40+
// Only use this repository for either snapshots or releases
41+
repositoryUrl == apacheSnapshots ? snapshotsOnly() : releasesOnly()
4742
}
4843
}
4944
}

0 commit comments

Comments
 (0)