From 29b14ea3b4bfe9dbba526a215bf3be12090aaaed Mon Sep 17 00:00:00 2001 From: "John P. Bindel" Date: Wed, 5 Nov 2025 15:14:14 -0600 Subject: [PATCH] Issue348 Log message only if trying to change maven property from ant task It is expected that some values may be different, specifically the special "ant.file" property can change between invocations of the antrun plugin (e.g., changing name from pom.xml to .flattened.pom.xml in some projects), and we do not want to issue warnings for such expected situations. Instead, we log an INFO message when we are skipping a value, and we log nothing for property values that are the same in Ant and Maven. The old behavior was to log a debug message, and new behavior is logging an info message only for rare things that may be surprising, but are generally innocuous and expected. --- .../org/apache/maven/plugins/antrun/AntRunMojo.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/antrun/AntRunMojo.java b/src/main/java/org/apache/maven/plugins/antrun/AntRunMojo.java index 5ff1844..2f87b3f 100644 --- a/src/main/java/org/apache/maven/plugins/antrun/AntRunMojo.java +++ b/src/main/java/org/apache/maven/plugins/antrun/AntRunMojo.java @@ -461,9 +461,13 @@ public void copyProperties(Project antProject, MavenProject mavenProject) { for (Map.Entry entry : antProps.entrySet()) { String key = entry.getKey(); - if (mavenProperties.getProperty(key) != null) { - getLog().warn("Ant property '" + key + "=" + mavenProperties.getProperty(key) - + "' clashes with an existing Maven property, SKIPPING this Ant property propagation."); + String mavenValue = mavenProperties.getProperty(key); + if (mavenValue != null) { + if (!mavenValue.equals(entry.getValue())) { + getLog().info("Ant property '" + key + "=" + entry.getValue() + + "' clashes with an existing Maven property value '" + mavenValue + + "', SKIPPING this Ant property propagation."); + } continue; } // it is safe to call toString directly since the value cannot be null in Hashtable