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

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-parent.git


The following commit(s) were added to refs/heads/master by this push:
     new 24298e9  Document @{argLine} to preserve the JaCoCo agent in surefire 
argLine
24298e9 is described below

commit 24298e92501da27d5dac486d033e358fe355e76a
Author: Alex Herbert <[email protected]>
AuthorDate: Sat Nov 21 16:08:18 2026 +0000

    Document @{argLine} to preserve the JaCoCo agent in surefire argLine
    
    Use of the previously documented ${argLine} advice does not work on
    Java 21+. The java-21-up profile defines argLine as a property, so
    ${argLine} is resolved when the POM is read, before JaCoCo sets it,
    and the JaCoCo agent is silently dropped. Use of Surefire's late
    property evaluation syntax @{argLine} corrects this to allow JaCoCo
    instrumentation.
    
    Generated-by: Claude Code (claude-opus-5-5)
---
 pom.xml                 | 12 ++++++++++--
 src/changes/changes.xml |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3535efd..fee87ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -615,9 +615,17 @@
           <!-- Note that since JaCoCo relies on an agent to perform tests,
             it changes the surefire arguments line. If a component also
             needs to change the argument line of maven-surefire-plugin,
-            then it must add ${argLine} property (which is set by JaCoCo)
+            then it must add the argLine property (which is set by JaCoCo)
             in the argLine configuration element of maven-surefire-plugin
-            to preserve JaCoCo settings. -->
+            to preserve JaCoCo settings, using Surefire's late property
+            evaluation syntax:
+              <argLine>@{argLine} -your -extra -arguments</argLine>
+            Do not use ${argLine}: the java-21-up profile defines argLine as a
+            property, so ${argLine} is resolved when the POM is read, before
+            JaCoCo sets it, and the JaCoCo agent is silently dropped (tests 
pass
+            but no coverage is recorded). If the build can run without the
+            jacoco profile, define an empty argLine property so that @{argLine}
+            always resolves. -->
           <executions>
             <execution>
               <id>prepare-agent</id>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cab9e45..df0e27c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -59,6 +59,7 @@ The <action> type attribute can be add,update,fix,remove.
     <body>
       <release version="108" date="YYYY-MM-DD" description="This is a feature 
and maintenance release. Java 8 or later is required.">
         <!-- FIX -->
+        <action type="fix" dev="aherbert" due-to="Alex Herbert">Document the 
use of @{argLine} (not ${argLine}) to preserve the JaCoCo agent when a 
component sets the maven-surefire-plugin argLine.</action>
         <!-- ADD -->
         <action type="add" dev="ggregory" due-to="Gary Gregory">Add Maven 
profile `ava28-tests` to temporarily allow Mockito/Objenesis to construct test 
doubles on JDK 28 and later.</action>
         <!-- UPDATE -->

Reply via email to