Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android.useAndroidX = true
# Version of Log4j Core
#
# Default: last stable 2.x release
log4j.version = 2.24.3
log4jVersion = 2.25.1

##
# Staging Maven Repository
Expand Down
8 changes: 3 additions & 5 deletions log4j-samples-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ android {
}
}

def log4jVersion = providers.environmentVariable("LOG4J_VERSION").getOrElse("2.+")

dependencies {

implementation 'androidx.appcompat:appcompat:1.7.1'
Expand All @@ -63,9 +61,9 @@ dependencies {
androidTestImplementation 'org.assertj:assertj-core:3.27.4'

// Log4j
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4jVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
androidTestImplementation(group: 'org.apache.logging.log4j', name: 'log4j-core-test', version: log4jVersion) {
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: project.ext.log4jVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: project.ext.log4jVersion
androidTestImplementation(group: 'org.apache.logging.log4j', name: 'log4j-core-test', version: project.ext.log4jVersion) {
exclude group: 'com.google.code.java-allocation-instrumenter'
exclude group: 'org.apache.logging.log4j', module: 'log4j-api-test'
exclude group: 'org.hamcrest'
Expand Down
4 changes: 1 addition & 3 deletions log4j-samples-gradle-metadata/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ plugins {
id("application")
}

def log4jVersion = providers.environmentVariable("LOG4J_VERSION").getOrElse("2.25.0")

application {
mainModule = "org.example.log4j.metadata"
mainClass = "org.example.App" // see: src/main/java/org/example/App.java
}

dependencies {
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
implementation("org.apache.logging.log4j:log4j-api:${project.ext.log4jVersion}")
}

tasks.withType(JavaCompile).configureEach {
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ dependencyResolutionManagement {
}
}
rootProject.name = 'logging-log4j-samples'
def log4jVersion = providers.environmentVariable("LOG4J_VERSION")
.orElse(providers.gradleProperty("log4jVersion"))
.get()
gradle.beforeProject { Project it ->
it.ext.log4jVersion = log4jVersion
}

// Android example
include ':app'
Expand Down
Loading