From d99e28178d1629f82368a4ae0a43f7d8238fdef1 Mon Sep 17 00:00:00 2001 From: JesseBrault0709 <62299747+JesseBrault0709@users.noreply.github.com> Date: Mon, 6 May 2024 20:08:47 +0200 Subject: [PATCH] Fixed logging plugin writing over by default an already copied config. --- .../gradle/logging/GroowtLoggingPlugin.groovy | 7 ++----- cli/src/main/resources/log4j2.xml | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 cli/src/main/resources/log4j2.xml diff --git a/buildSrc/src/main/groovy/groowt/gradle/logging/GroowtLoggingPlugin.groovy b/buildSrc/src/main/groovy/groowt/gradle/logging/GroowtLoggingPlugin.groovy index cffc787..220324d 100644 --- a/buildSrc/src/main/groovy/groowt/gradle/logging/GroowtLoggingPlugin.groovy +++ b/buildSrc/src/main/groovy/groowt/gradle/logging/GroowtLoggingPlugin.groovy @@ -25,9 +25,10 @@ class GroowtLoggingPlugin implements Plugin { javaExtension.sourceSets.each { sourceSet -> project.tasks.register( - sourceSet.getTaskName('copy', 'LoggingConfig'), + sourceSet.getTaskName('copyLoggingConfigTo', 'Resources'), GroowtCopyLoggerConfigTask ) { task -> + task.group = 'logging' task.from(tmpLog4j2Xml) task.rename { 'log4j2.xml' } task.into(['src', sourceSet.name, 'resources'].join(File.separator)) @@ -45,10 +46,6 @@ class GroowtLoggingPlugin implements Plugin { project.dependencies.addProvider( 'runtimeOnly', libs.findLibrary('log4j-slf4jBinding').orElseThrow() ) - - project.tasks.named('build') { - it.dependsOn project.tasks.withType(GroowtCopyLoggerConfigTask) - } } } diff --git a/cli/src/main/resources/log4j2.xml b/cli/src/main/resources/log4j2.xml new file mode 100644 index 0000000..5081d05 --- /dev/null +++ b/cli/src/main/resources/log4j2.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + +