You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/12/19 14:17:07 UTC
(logging-log4j-samples) branch main updated: Limit `log4j.repository.url` usage to releases-only
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j-samples.git
The following commit(s) were added to refs/heads/main by this push:
new 6774433 Limit `log4j.repository.url` usage to releases-only
6774433 is described below
commit 6774433357021a5c5cc550fb67ba47dd0c246bfa
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Thu Dec 19 15:16:57 2024 +0100
Limit `log4j.repository.url` usage to releases-only
---
.github/workflows/android-reusable-test.yaml | 4 +-
.github/workflows/graalvm-reusable-test.yaml | 4 +-
.github/workflows/integration-test.yaml | 8 ++--
log4j-samples-android/gradle.properties | 2 +-
log4j-samples-android/settings.gradle | 14 +++++--
log4j-samples-graalvm/pom.xml | 59 ++++++++++++++++++----------
pom.xml | 59 +++++++++++++++++++---------
7 files changed, 97 insertions(+), 53 deletions(-)
diff --git a/.github/workflows/android-reusable-test.yaml b/.github/workflows/android-reusable-test.yaml
index 4842094..9a650db 100644
--- a/.github/workflows/android-reusable-test.yaml
+++ b/.github/workflows/android-reusable-test.yaml
@@ -26,9 +26,9 @@ on:
# Should point to the current 2.x snapshot version
default: 2.25.0-SNAPSHOT
log4j-repository-url:
- description: Additional Maven repository
+ description: Staging Maven repository. Should be empty for snapshots.
type: string
- default: 'https://repository.apache.org/snapshots'
+ default: ''
samples-ref:
description: The branch, tag or SHA of `logging-log4j-samples` to checkout
type: string
diff --git a/.github/workflows/graalvm-reusable-test.yaml b/.github/workflows/graalvm-reusable-test.yaml
index 15549b8..88e66fc 100644
--- a/.github/workflows/graalvm-reusable-test.yaml
+++ b/.github/workflows/graalvm-reusable-test.yaml
@@ -26,9 +26,9 @@ on:
# Should point to the current 2.x snapshot version
default: 2.25.0-SNAPSHOT
log4j-repository-url:
- description: Additional Maven repository
+ description: Staging Maven repository. Should be empty for snapshots.
type: string
- default: 'https://repository.apache.org/snapshots'
+ default: ''
samples-ref:
description: The branch, tag or SHA of `logging-log4j-samples` to checkout
type: string
diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml
index 55473be..a2f8670 100644
--- a/.github/workflows/integration-test.yaml
+++ b/.github/workflows/integration-test.yaml
@@ -26,9 +26,9 @@ on:
# Should point to the current 2.x snapshot version
default: 2.25.0-SNAPSHOT
log4j-repository-url:
- description: Additional Maven repository
+ description: Staging Maven repository. Should be empty for snapshots.
type: string
- default: 'https://repository.apache.org/snapshots'
+ default: ''
samples-ref:
description: The branch, tag or SHA of `logging-log4j-samples` to checkout
type: string
@@ -40,8 +40,8 @@ on:
# Should point to the current 2.x snapshot version
default: 2.25.0-SNAPSHOT
log4j-repository-url:
- description: Additional Maven repository
- default: 'https://repository.apache.org/snapshots'
+ description: Staging Maven repository. Should be empty for snapshots.
+ default: ''
samples-ref:
description: The branch, tag or SHA of `logging-log4j-samples` to checkout
type: string
diff --git a/log4j-samples-android/gradle.properties b/log4j-samples-android/gradle.properties
index 1258a0a..993fb69 100644
--- a/log4j-samples-android/gradle.properties
+++ b/log4j-samples-android/gradle.properties
@@ -22,7 +22,7 @@ android.useAndroidX = true
# Version of Log4j Core
#
# Default: last stable 2.x release
-log4j.version = 2.24.1
+log4j.version = 2.24.3
##
# Additional Maven repository
diff --git a/log4j-samples-android/settings.gradle b/log4j-samples-android/settings.gradle
index 018f37e..e527c2a 100644
--- a/log4j-samples-android/settings.gradle
+++ b/log4j-samples-android/settings.gradle
@@ -26,12 +26,18 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
- // Points to the correct Apache snapshot/staging repository
+ // Points to the correct Apache staging repository
//
// See gradle.properties
- maven {
- name = 'Apache Repository'
- url = providers.gradleProperty("log4j.repository.url")
+ var repositoryUrl = providers.gradleProperty("log4j.repository.url")
+ if (repositoryUrl != null && !repositoryUrl.toString().isEmpty()) {
+ maven {
+ name = 'Apache Repository'
+ url = repositoryUrl
+ mavenContent {
+ releasesOnly()
+ }
+ }
}
}
}
diff --git a/log4j-samples-graalvm/pom.xml b/log4j-samples-graalvm/pom.xml
index ea53d5b..02e84ea 100644
--- a/log4j-samples-graalvm/pom.xml
+++ b/log4j-samples-graalvm/pom.xml
@@ -30,19 +30,12 @@
<properties>
<!--
- ~ Version of Log4j Core
- ~
- ~ Set to latest stable 2.x release for users.
- ~ Our workflows override this.
- -->
- <log4j.version>2.24.1</log4j.version>
- <!--
- ~ Additional Maven repository
+ ~ Version of Log4j Core
~
- ~ Default: Apache Snapshots Repository
+ ~ Set to latest stable 2.x release for users.
~ Our workflows override this.
-->
- <log4j.repository.url>https://repository.apache.org/snapshots</log4j.repository.url>
+ <log4j.version>2.24.1</log4j.version>
<!-- Some samples require JDK 9+ -->
<minimalJavaBuildVersion>17</minimalJavaBuildVersion>
@@ -146,17 +139,6 @@
</dependencies>
- <repositories>
-
- <!-- The repository that contains the requested Log4j version -->
- <repository>
- <id>log4j</id>
- <name>Log4j Maven Repository</name>
- <url>${log4j.repository.url}</url>
- </repository>
-
- </repositories>
-
<build>
<plugins>
@@ -506,5 +488,40 @@
</plugins>
</build>
</profile>
+
+ <!--
+ ~ An additional Maven staging repository if the `log4j.repository.url` property is not empty.
+ -->
+ <profile>
+ <id>staging-repo</id>
+ <activation>
+ <property>
+ <name>log4j.repository.url</name>
+ <value>!</value>
+ </property>
+ </activation>
+
+ <repositories>
+ <!-- Use primarily Maven Central -->
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>https://repo.maven.apache.org/maven2</url>
+ </repository>
+ <!-- The repository that contains the requested Log4j version -->
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>log4j-staging</id>
+ <name>Log4j Staging Repository</name>
+ <url>${log4j.repository.url}</url>
+ </repository>
+ </repositories>
+ </profile>
+
</profiles>
</project>
diff --git a/pom.xml b/pom.xml
index 4585e25..2ea61e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,14 +62,7 @@
~ Set to latest stable 2.x release for users.
~ Our workflows override this.
-->
- <log4j.version>3.0.0-beta3</log4j.version>
- <!--
- ~ Additional Maven repository
- ~
- ~ Default: Apache Snapshots Repository
- ~ Our workflows override this.
- -->
- <log4j.repository.url>https://repository.apache.org/snapshots</log4j.repository.url>
+ <log4j.version>2.24.3</log4j.version>
<!-- Some samples require JDK 17+ -->
<minimalJavaBuildVersion>17</minimalJavaBuildVersion>
@@ -244,17 +237,6 @@
</dependencies>
</dependencyManagement>
- <repositories>
-
- <!-- The repository that contains the requested Log4j version -->
- <repository>
- <id>log4j</id>
- <name>Log4j Maven Repository</name>
- <url>${log4j.repository.url}</url>
- </repository>
-
- </repositories>
-
<build>
<pluginManagement>
@@ -301,4 +283,43 @@
</build>
+ <profiles>
+
+ <!--
+ ~ An additional Maven staging repository if the `log4j.repository.url` property is not empty.
+ -->
+ <profile>
+ <id>staging-repo</id>
+ <activation>
+ <property>
+ <name>log4j.repository.url</name>
+ <value>!</value>
+ </property>
+ </activation>
+
+ <repositories>
+ <!-- Use primarily Maven Central -->
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>https://repo.maven.apache.org/maven2</url>
+ </repository>
+ <!-- The repository that contains the requested Log4j version -->
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>log4j-staging</id>
+ <name>Log4j Staging Repository</name>
+ <url>${log4j.repository.url}</url>
+ </repository>
+ </repositories>
+
+ </profile>
+
+ </profiles>
+
</project>