This is an automated email from the ASF dual-hosted git repository.

pkarwasz pushed a commit to branch feature/simplify-dep-management
in repository https://gitbox.apache.org/repos/asf/logging-log4j-samples.git

commit 4459eac7c91efa2d51e0efe0bdfef58583493a25
Author: Piotr P. Karwasz <pkarwasz-git...@apache.org>
AuthorDate: Thu Apr 10 23:54:53 2025 +0200

    Remove Apache Snapshots from release builds
    
    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.
---
 settings.gradle | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/settings.gradle b/settings.gradle
index 9b3d409..6883315 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -26,24 +26,19 @@ dependencyResolutionManagement {
     repositories {
         google()
         mavenCentral()
+        // Points to the correct Apache staging repository
+        var apacheSnapshots = 'https://repository.apache.org/snapshots'
+        var repositoryUrl = providers.gradleProperty('log4j.repository.url')
+                .filter { !it.isEmpty() }
+                .getOrElse(apacheSnapshots)
         maven {
-            name = 'Apache Snapshots Repository'
-            url = "https://repository.apache.org/snapshots";
+            name = 'Log4j Repository'
+            url = repositoryUrl
             mavenContent {
-                snapshotsOnly()
-            }
-        }
-        // Points to the correct Apache staging repository
-        //
-        // See gradle.properties
-        var repositoryUrl = providers.gradleProperty("log4j.repository.url")
-        if (repositoryUrl != null && !repositoryUrl.toString().isEmpty()) {
-            maven {
-                name = 'Apache Repository'
-                url = repositoryUrl
-                mavenContent {
-                    releasesOnly()
-                }
+                // Only use this repository for Apache Logging Services 
artifacts
+                includeGroupAndSubgroups('org.apache.logging')
+                // Only use this repository for either snapshots or releases
+                repositoryUrl == apacheSnapshots ? snapshotsOnly() : 
releasesOnly()
             }
         }
     }

Reply via email to