parameters = findNamedChild( parametersNode, "parameter" );
+ append( sb, "Available parameters:", 1 );
+ append( sb, "", 0 );
+
+ for ( Node parameter : parameters )
+ {
+ writeParameter( sb, parameter, configurationElement );
+ }
+ }
+ }
+ }
+
+ private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement )
+ throws MojoExecutionException
+ {
+ String parameterName = getValue( parameter, "name" );
+ String parameterDescription = getValue( parameter, "description" );
+
+ Element fieldConfigurationElement = null;
+ if ( configurationElement != null )
+ {
+ fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName );
+ }
+
+ String parameterDefaultValue = "";
+ if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) )
+ {
+ parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")";
+ }
+ append( sb, parameterName + parameterDefaultValue, 2 );
+ Node deprecated = findSingleChild( parameter, "deprecated" );
+ if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) )
+ {
+ append( sb, "Deprecated. " + deprecated.getTextContent(), 3 );
+ append( sb, "", 0 );
+ }
+ if ( isNotEmpty( parameterDescription ) ) {
+ append( sb, parameterDescription, 3 );
+ }
+ if ( "true".equals( getValue( parameter, "required" ) ) )
+ {
+ append( sb, "Required: Yes", 3 );
+ }
+ if ( ( fieldConfigurationElement != null ) && isNotEmpty( fieldConfigurationElement.getTextContent() ) )
+ {
+ String property = getPropertyFromExpression( fieldConfigurationElement.getTextContent() );
+ append( sb, "User property: " + property, 3 );
+ }
+
+ append( sb, "", 0 );
+ }
+
+ /**
+ * Repeat a String n
times to form a new string.
+ *
+ * @param str String to repeat
+ * @param repeat number of times to repeat str
+ * @return String with repeated String
+ * @throws NegativeArraySizeException if repeat < 0
+ * @throws NullPointerException if str is null
+ */
+ private static String repeat( String str, int repeat )
+ {
+ StringBuilder buffer = new StringBuilder( repeat * str.length() );
+
+ for ( int i = 0; i < repeat; i++ )
+ {
+ buffer.append( str );
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ * Append a description to the buffer by respecting the indentSize and lineLength parameters.
+ * Note: The last character is always a new line.
+ *
+ * @param sb The buffer to append the description, not null
.
+ * @param description The description, not null
.
+ * @param indent The base indentation level of each line, must not be negative.
+ */
+ private void append( StringBuilder sb, String description, int indent )
+ {
+ for ( String line : toLines( description, indent, indentSize, lineLength ) )
+ {
+ sb.append( line ).append( '\n' );
+ }
+ }
+
+ /**
+ * Splits the specified text into lines of convenient display length.
+ *
+ * @param text The text to split into lines, must not be null
.
+ * @param indent The base indentation level of each line, must not be negative.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ * @return The sequence of display lines, never null
.
+ * @throws NegativeArraySizeException if indent < 0
+ */
+ private static List toLines( String text, int indent, int indentSize, int lineLength )
+ {
+ List lines = new ArrayList();
+
+ String ind = repeat( "\t", indent );
+
+ String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
+
+ for ( String plainLine : plainLines )
+ {
+ toLines( lines, ind + plainLine, indentSize, lineLength );
+ }
+
+ return lines;
+ }
+
+ /**
+ * Adds the specified line to the output sequence, performing line wrapping if necessary.
+ *
+ * @param lines The sequence of display lines, must not be null
.
+ * @param line The line to add, must not be null
.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ */
+ private static void toLines( List lines, String line, int indentSize, int lineLength )
+ {
+ int lineIndent = getIndentLevel( line );
+ StringBuilder buf = new StringBuilder( 256 );
+
+ String[] tokens = line.split( " +" );
+
+ for ( String token : tokens )
+ {
+ if ( buf.length() > 0 )
+ {
+ if ( buf.length() + token.length() >= lineLength )
+ {
+ lines.add( buf.toString() );
+ buf.setLength( 0 );
+ buf.append( repeat( " ", lineIndent * indentSize ) );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+ }
+
+ for ( int j = 0; j < token.length(); j++ )
+ {
+ char c = token.charAt( j );
+ if ( c == '\t' )
+ {
+ buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
+ }
+ else if ( c == '\u00A0' )
+ {
+ buf.append( ' ' );
+ }
+ else
+ {
+ buf.append( c );
+ }
+ }
+ }
+ lines.add( buf.toString() );
+ }
+
+ /**
+ * Gets the indentation level of the specified line.
+ *
+ * @param line The line whose indentation level should be retrieved, must not be null
.
+ * @return The indentation level of the line.
+ */
+ private static int getIndentLevel( String line )
+ {
+ int level = 0;
+ for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
+ {
+ level++;
+ }
+ for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
+ {
+ if ( line.charAt( i ) == '\t' )
+ {
+ level++;
+ break;
+ }
+ }
+ return level;
+ }
+
+ private static String getPropertyFromExpression( String expression )
+ {
+ if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" )
+ && !expression.substring( 2 ).contains( "${" ) )
+ {
+ // expression="${xxx}" -> property="xxx"
+ return expression.substring( 2, expression.length() - 1 );
+ }
+ // no property can be extracted
+ return null;
+ }
+}
diff -urEbwBN a/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-plugin/plugin-help.xml b/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-plugin/plugin-help.xml
--- a/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-plugin/plugin-help.xml 1970-01-01 01:00:00.000000000 +0100
+++ b/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-plugin/plugin-help.xml 2024-11-04 10:47:52.325388910 +0100
@@ -0,0 +1,812 @@
+
+
+
+
+
+ ${project.name}
+ ${project.description}
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ surefire
+
+
+ help
+ Display help information on maven-surefire-plugin.
+Call mvn surefire:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
+ false
+ false
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.maven_surefire_plugin.HelpMojo
+ java
+ per-lookup
+ once-per-session
+ true
+
+
+ detail
+ boolean
+ false
+ true
+ If true, display all settable properties for each goal.
+
+
+ goal
+ java.lang.String
+ false
+ true
+ The name of the goal for which to show help. If unspecified, all goals will be displayed.
+
+
+ indentSize
+ int
+ false
+ true
+ The number of spaces per indentation level, should be positive.
+
+
+ lineLength
+ int
+ false
+ true
+ The maximum length of a display line, should be positive.
+
+
+
+ ${detail}
+ ${goal}
+ ${indentSize}
+ ${lineLength}
+
+
+
+ test
+ Run tests using Surefire.
+ test
+ false
+ true
+ false
+ false
+ false
+ true
+ test
+ org.apache.maven.plugin.surefire.SurefireMojo
+ java
+ per-lookup
+ once-per-session
+ true
+
+
+ additionalClasspathDependencies
+ java.util.List<org.apache.maven.model.Dependency>
+ false
+ true
+
+
+
+ additionalClasspathElements
+ java.lang.String[]
+ false
+ true
+
+
+
+ argLine
+ java.lang.String
+ false
+ true
+
+
+
+ childDelegation
+ boolean
+ false
+ true
+
+
+
+ classesDirectory
+ java.io.File
+ false
+ true
+ The directory containing generated classes of the project being tested. This will be included after the test classes in the test classpath.
+
+
+ classpathDependencyExcludes
+ java.lang.String[]
+ false
+ true
+
+
+
+ classpathDependencyScopeExclude
+ java.lang.String
+ false
+ true
+
+
+
+ consoleOutputReporter
+ org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter
+ false
+ true
+
+
+
+ debugForkedProcess
+ java.lang.String
+ 2.4
+ false
+ true
+ Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure arbitrary debuggability options (without overwriting the other options specified through the argLine parameter).
+
+
+ dependenciesToScan
+ java.lang.String[]
+ false
+ true
+
+
+
+ disableXmlReport
+ java.lang.Boolean
+ No reason given
+ false
+ true
+
+
+
+ enableAssertions
+ boolean
+ false
+ true
+
+
+
+ enableOutErrElements
+ boolean
+ false
+ true
+
+
+
+ enableProcessChecker
+ java.lang.String
+ 3.0.0-M4
+ false
+ true
+ Since 3.0.0-M4 the process checkers are disabled. You can enable them namely by setting ping and native or all in this parameter.
+The checker is useful in situations when you kill the build on a CI system and you want the Surefire forked JVM to kill the tests asap and free all handlers on the file system been previously used by the JVM and by the tests.
+The ping should be safely used together with ZGC or Shenandoah Garbage Collector. Due to the ping relies on timing of the PING (triggered every 30 seconds), slow GCs may pause the timers and pretend that the parent process of the forked JVM does not exist.
+The native is very fast checker. It is useful mechanism on Unix based systems, Linux distributions and Alpine/BusyBox Linux. See the JIRA SUREFIRE-1631 <https://issues.apache.org/jira/browse/SUREFIRE-1631> for Windows issues.
+Another useful configuration parameter is forkedProcessTimeoutInSeconds.
+See the Frequently Asked Questions page with more details:
+http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm <http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm>
+http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm <http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm>
+Example of use:
+mvn test -Dsurefire.enableProcessChecker=all
+
+
+ enablePropertiesElement
+ boolean
+ false
+ true
+
+
+
+ encoding
+ java.lang.String
+ 3.0.0-M1
+ false
+ true
+ The character encoding scheme to be applied while generating test report files (see target/surefire-reports/yourTestName.txt). The report output files (*-out.txt) are encoded in UTF-8 if not set otherwise.
+
+
+ environmentVariables
+ java.util.Map<java.lang.String, java.lang.String>
+ false
+ true
+
+
+
+ excludeJUnit5Engines
+ java.lang.String[]
+ 3.0.0-M6
+ false
+ true
+ Provide the ID/s of an JUnit engine to be excluded in the test run.
+
+
+ excludedEnvironmentVariables
+ java.lang.String[]
+ 3.0.0-M4
+ false
+ true
+ You can selectively exclude individual environment variables by enumerating their keys.
+The environment is a system-dependent mapping from keys to values which is inherited from the Maven process to the forked Surefire processes. The keys must literally (case sensitive) match in order to exclude their environment variable.
+Example to exclude three environment variables:
+mvn test -Dsurefire.excludedEnvironmentVariables=ACME1,ACME2,ACME3
+
+
+ excludedGroups
+ java.lang.String
+ false
+ true
+
+
+
+ excludes
+ java.util.List<java.lang.String>
+ false
+ true
+ A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be
+<excludes> <exclude>**/*$*</exclude> </excludes> (which excludes all inner classes).
+This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
+Each exclude item may also contain a comma-separated sub-list of items, which will be treated as multiple <exclude> entries.
+Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): <exclude>%regex[pkg.*Slow.*.class], Unstable*</exclude>
+Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter testClassesDirectory which defaults to the POM property ${project.build.testOutputDirectory}, typically src/test/java unless overridden.
+
+
+ excludesFile
+ java.io.File
+ 2.13
+ false
+ true
+ A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If excludes are also specified, these patterns are appended. Example with path, simple and regex excludes:
+*/test/* **/DontRunTest.* %regex[.*Test.*|.*Not.*] Since 3.0.0-M6, method filtering support is provided in the exclusions file as well, example: pkg.SomeTest#testMethod
+
+
+ failIfNoSpecifiedTests
+ boolean
+ 2.12
+ false
+ true
+ Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to "true".
+
+
+ failIfNoTests
+ boolean
+ false
+ true
+
+
+
+ failOnFlakeCount
+ int
+ 3.0.0-M6
+ false
+ true
+ Set this to a value greater than 0 to fail the whole test set if the cumulative number of flakes reaches this threshold. Set to 0 to allow an unlimited number of flakes.
+
+
+ forkCount
+ java.lang.String
+ false
+ true
+
+
+
+ forkNode
+ org.apache.maven.surefire.extensions.ForkNodeFactory
+ 3.0.0-M5
+ false
+ true
+ This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process pipes or TCP/IP sockets. The plugin uses process pipes by default which will be turned to TCP/IP in the version 3.0.0. Alternatively, you can implement your own factory and SPI.
+See the documentation for more details:
+https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html <https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html>
+
+
+ forkedProcessExitTimeoutInSeconds
+ int
+ 2.20
+ false
+ true
+ Forked process is normally terminated without any significant delay after given tests have completed. If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated by System.exit(). Use this parameter in order to determine the timeout of terminating the process. see the documentation: http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html <http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html> Turns to default fallback value of 30 seconds if negative integer.
+
+
+ forkedProcessTimeoutInSeconds
+ int
+ 2.4
+ false
+ true
+ Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out.
+
+
+ groups
+ java.lang.String
+ false
+ true
+
+
+
+ includeJUnit5Engines
+ java.lang.String[]
+ 3.0.0-M6
+ false
+ true
+ Provide the ID/s of an JUnit engine to be included in the test run.
+
+
+ includes
+ java.util.List<java.lang.String>
+ false
+ true
+ A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be <includes> <include>**/Test*.java</include> <include>**/*Test.java</include> <include>**/*Tests.java</include> <include>**/*TestCase.java</include> </includes> Each include item may also contain a comma-separated sub-list of items, which will be treated as multiple <include> entries.
+Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): <include>%regex[.*[Cat|Dog].*], Basic????, !Unstable*</include> <include>%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg/**/*Fast*.java</include>
+This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
+
+Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter testClassesDirectory which defaults to the POM property ${project.build.testOutputDirectory}, typically src/test/java unless overridden.
+
+
+ includesFile
+ java.io.File
+ 2.13
+ false
+ true
+ A file containing include patterns. Blank lines, or lines starting with # are ignored. If includes are also specified, these patterns are appended. Example with path, simple and regex includes: */test/* **/NotIncludedByDefault.java %regex[.*Test.*|.*Not.*]
+Since 3.0.0-M6, method filtering support is provided in the inclusions file as well, example: pkg.SomeTest#testMethod
+
+
+ jdkToolchain
+ java.util.Map<java.lang.String, java.lang.String>
+ false
+ true
+
+
+
+ junitArtifactName
+ java.lang.String
+ false
+ true
+
+
+
+ jvm
+ java.lang.String
+ false
+ true
+
+
+
+ objectFactory
+ java.lang.String
+ false
+ true
+
+
+
+ parallel
+ java.lang.String
+ false
+ true
+
+
+
+ parallelOptimized
+ boolean
+ false
+ true
+
+
+
+ parallelTestsTimeoutForcedInSeconds
+ double
+ 2.16
+ false
+ true
+ Stop executing queued parallel JUnit tests and interrupt currently running tests after a certain number of seconds.
+Example values: "3.5", "4"
+
+If set to 0, wait forever, never timing out. Makes sense with specified parallel different from "none".
+
+
+ parallelTestsTimeoutInSeconds
+ double
+ 2.16
+ false
+ true
+ Stop executing queued parallel JUnit tests after a certain number of seconds.
+Example values: "3.5", "4"
+
+If set to 0, wait forever, never timing out. Makes sense with specified parallel different from "none".
+
+
+ perCoreThreadCount
+ boolean
+ false
+ true
+
+
+
+ printSummary
+ boolean
+ false
+ true
+ Option to print summary of test suites or just print the test cases that have errors.
+
+
+ promoteUserPropertiesToSystemProperties
+ boolean
+ false
+ true
+
+
+
+ properties
+ java.util.Properties
+ false
+ true
+
+
+
+ redirectTestOutputToFile
+ boolean
+ false
+ true
+
+
+
+ reportFormat
+ java.lang.String
+ false
+ true
+ Selects the formatting for the test report to be generated. Can be set as "brief" or "plain". Only applies to the output format of the output files (target/surefire-reports/testName.txt)
+
+
+ reportNameSuffix
+ java.lang.String
+ false
+ true
+
+
+
+ reportsDirectory
+ java.io.File
+ false
+ true
+ Base directory where all reports are written to.
+
+
+ rerunFailingTestsCount
+ int
+ false
+ true
+ (JUnit 4+ providers and JUnit 5+ providers since 3.0.0-M4) The number of times each failing test will be rerun. If set larger than 0, rerun failing tests immediately after they fail. If a failing test passes in any of those reruns, it will be marked as pass and reported as a "flake". However, all the failing attempts will be recorded.
+
+
+ reuseForks
+ boolean
+ false
+ true
+
+
+
+ runOrder
+ java.lang.String
+ 2.7
+ false
+ true
+ Defines the order the tests will be run in. Supported values are alphabetical, reversealphabetical, random, hourly (alphabetical on even hours, reverse alphabetical on odd hours), failedfirst, balanced and filesystem.
+
+Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a multi-module build.
+
+Failed first will run tests that failed on previous run first, as well as new tests for this run.
+
+Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the overall execution time. Initially a statistics file is created and every next test run will reorder classes.
+
+Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml and should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different configurations will have different statistics files, meaning if you change any configuration settings you will re-run once before new statistics data can be established.
+
+
+ runOrderRandomSeed
+ java.lang.Long
+ 3.0.0-M6
+ false
+ true
+ Sets the random seed that will be used to order the tests if surefire.runOrder is set to random.
+
+If no seeds are set and surefire.runOrder is set to random, then the seed used will be outputted (search for "To reproduce ordering use flag -Dsurefire.runOrder.random.seed").
+
+To deterministically reproduce any random test order that was run before, simply set the seed to be the same value.
+
+
+ shutdown
+ java.lang.String
+ 2.19
+ false
+ true
+ After the plugin process is shutdown by sending SIGTERM signal (CTRL+C), SHUTDOWN command is received by every forked JVM.
+The value is set to (shutdown=exit) by default (changed in version 3.0.0-M4).
+The parameter can be configured with other two values testset and kill.
+With(shutdown=testset) the test set may still continue to run in forked JVM.
+Using exit forked JVM executes System.exit(1) after the plugin process has received SIGTERM signal.
+Using kill the JVM executes Runtime.halt(1) and kills itself.
+
+
+ skip
+ boolean
+ false
+ true
+
+
+
+ skipAfterFailureCount
+ int
+ 2.19
+ false
+ true
+ Set to error/failure count in order to skip remaining tests. Due to race conditions in parallel/forked execution this may not be fully guaranteed.
+Enable with system property -Dsurefire.skipAfterFailureCount=1 or any number greater than zero. Defaults to "0".
+See the prerequisites and limitations in documentation:
+http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html <http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html>
+
+
+ skipExec
+ boolean
+ No reason given
+ false
+ true
+
+
+
+ skipTests
+ boolean
+ false
+ true
+
+
+
+ statelessTestsetInfoReporter
+ org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter
+ false
+ true
+
+
+
+ statelessTestsetReporter
+ org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter
+ false
+ true
+
+
+
+ suiteXmlFiles
+ java.io.File[]
+ 2.2
+ false
+ true
+ (TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that suiteXmlFiles is incompatible with several other parameters of this plugin, like includes and excludes.
+This parameter is ignored if the test parameter is specified (allowing you to run a single test instead of an entire suite).
+
+
+ systemProperties
+ java.util.Properties
+ No reason given
+ false
+ true
+
+
+
+ systemPropertiesFile
+ java.io.File
+ false
+ true
+ Properties file being used as system properties passed to the provider.
+See also: AbstractSurefireMojo#systemPropertyVariables systemPropertyVariables for how the effective provider properties are calculated
+
+
+ systemPropertyVariables
+ java.util.Map<java.lang.String, java.lang.String>
+ false
+ true
+
+
+
+ tempDir
+ java.lang.String
+ false
+ true
+
+
+
+ test
+ java.lang.String
+ false
+ true
+ Specify this parameter to run individual tests by file name, overriding the parameter includes and excludes. Each pattern you specify here will be used to create an include pattern formatted like **/${test}.java, so you can just type -Dtest=MyTest to run a single test called "foo/MyTest.java". The test patterns prefixed with a ! will be excluded.
+This parameter overrides the parameter includes, excludes, and the TestNG parameter suiteXmlFiles.
+Since 2.7.3, you can execute a limited number of methods in the test by adding #myMethod or #my*ethod. For example, -Dtest=MyTest#myMethod. This is supported for junit 4.x and TestNg.
+
+Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): "-Dtest=???Test, !Unstable*, pkg/**/Ci*leTest.java, *Test#test*One+testTwo?????, #fast*+slowTest" or e.g. "-Dtest=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyTest.class#one.*|two.*], %regex[#fast.*|slow.*]"
+The Parameterized JUnit runner describes test methods using an index in brackets, so the non-regex method pattern would become: #testMethod[*]. If using @Parameters(name="{index}: fib({0})={1}") and selecting the index e.g. 5 in pattern, the non-regex method pattern would become #testMethod[5:*].
+
+
+ testClassesDirectory
+ java.io.File
+ false
+ true
+
+
+
+ testFailureIgnore
+ boolean
+ false
+ true
+ Set this to "true" to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
+
+
+ testNGArtifactName
+ java.lang.String
+ false
+ true
+
+
+
+ testSourceDirectory
+ java.io.File
+ false
+ true
+
+
+
+ threadCount
+ int
+ false
+ true
+
+
+
+ threadCountClasses
+ int
+ false
+ true
+
+
+
+ threadCountMethods
+ int
+ false
+ true
+
+
+
+ threadCountSuites
+ int
+ false
+ true
+
+
+
+ trimStackTrace
+ boolean
+ false
+ true
+
+
+
+ useFile
+ boolean
+ false
+ true
+ Option to generate a file test report or just output the test report to the console.
+
+
+ useManifestOnlyJar
+ boolean
+ 2.4.3
+ false
+ true
+ By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to launch your tests with a plain old Java classpath. (See the http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html <http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html> for a more detailed explanation of manifest-only JARs and their benefits.)
+Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
+
+
+ useModulePath
+ boolean
+ 3.0.0-M2
+ false
+ true
+ When true, uses the modulepath when executing with JDK 9+ and module-info.java is present. When false, always uses the classpath.
+Defaults to true.
+
+
+ useSystemClassLoader
+ boolean
+ 2.3
+ false
+ true
+ Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's ClassLoader.
+
+
+ useUnlimitedThreads
+ boolean
+ false
+ true
+
+
+
+ workingDirectory
+ java.io.File
+ false
+ true
+
+
+
+
+ ${maven.test.additionalClasspathDependencies}
+ ${maven.test.additionalClasspath}
+ ${argLine}
+ ${childDelegation}
+
+ ${maven.test.dependency.excludes}
+ ${maven.surefire.debug}
+ ${dependenciesToScan}
+ ${disableXmlReport}
+ ${enableAssertions}
+ ${enableOutErrElements}
+ ${surefire.enableProcessChecker}
+ ${enablePropertiesElement}
+ ${surefire.encoding}
+ ${surefire.excludeJUnit5Engines}
+ ${surefire.excludedEnvironmentVariables}
+ ${excludedGroups}
+ ${surefire.excludes}
+ ${surefire.excludesFile}
+ ${surefire.failIfNoSpecifiedTests}
+ ${failIfNoTests}
+ ${surefire.failOnFlakeCount}
+ ${forkCount}
+ ${surefire.forkNode}
+ ${surefire.exitTimeout}
+ ${surefire.timeout}
+ ${groups}
+ ${surefire.includeJUnit5Engines}
+ ${surefire.includes}
+ ${surefire.includesFile}
+ ${junitArtifactName}
+ ${jvm}
+ ${objectFactory}
+ ${parallel}
+ ${parallelOptimized}
+ ${surefire.parallel.forcedTimeout}
+ ${surefire.parallel.timeout}
+ ${perCoreThreadCount}
+ ${surefire.printSummary}
+
+ ${maven.test.redirectTestOutputToFile}
+ ${surefire.reportFormat}
+ ${surefire.reportNameSuffix}
+
+ ${surefire.rerunFailingTestsCount}
+ ${reuseForks}
+ ${surefire.runOrder}
+ ${surefire.runOrder.random.seed}
+ ${surefire.shutdown}
+ ${maven.test.skip}
+ ${surefire.skipAfterFailureCount}
+ ${maven.test.skip.exec}
+ ${skipTests}
+ ${surefire.suiteXmlFiles}
+ ${surefire.systemPropertiesFile}
+ ${tempDir}
+ ${test}
+
+ ${maven.test.failure.ignore}
+ ${testNGArtifactName}
+
+ ${threadCount}
+ ${threadCountClasses}
+ ${threadCountMethods}
+ ${threadCountSuites}
+ ${trimStackTrace}
+ ${surefire.useFile}
+ ${surefire.useManifestOnlyJar}
+ ${surefire.useModulePath}
+ ${surefire.useSystemClassLoader}
+ ${useUnlimitedThreads}
+ ${basedir}
+
+
+
+
diff -urEbwBN a/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml b/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml
--- a/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml 1970-01-01 01:00:00.000000000 +0100
+++ b/maven-surefire-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml 2024-11-04 10:48:40.175717003 +0100
@@ -0,0 +1,1012 @@
+
+
+
+
+
+ ${project.name}
+ ${project.description}
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ surefire
+ false
+ true
+ 1.8
+ 3.6.3
+
+
+ help
+ Display help information on maven-surefire-plugin.
+Call mvn surefire:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
+ false
+ false
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.maven_surefire_plugin.HelpMojo
+ java
+ per-lookup
+ once-per-session
+ true
+
+
+ detail
+ boolean
+ false
+ true
+ If true, display all settable properties for each goal.
+
+
+ goal
+ java.lang.String
+ false
+ true
+ The name of the goal for which to show help. If unspecified, all goals will be displayed.
+
+
+ indentSize
+ int
+ false
+ true
+ The number of spaces per indentation level, should be positive.
+
+
+ lineLength
+ int
+ false
+ true
+ The maximum length of a display line, should be positive.
+
+
+
+ ${detail}
+ ${goal}
+ ${indentSize}
+ ${lineLength}
+
+
+
+ test
+ Run tests using Surefire.
+ test
+ false
+ true
+ false
+ false
+ false
+ true
+ test
+ org.apache.maven.plugin.surefire.SurefireMojo
+ java
+ per-lookup
+ once-per-session
+ true
+
+
+ additionalClasspathDependencies
+ java.util.List
+ false
+ true
+
+
+
+ additionalClasspathElements
+ java.lang.String[]
+ false
+ true
+
+
+
+ argLine
+ java.lang.String
+ false
+ true
+
+
+
+ basedir
+ java.io.File
+ true
+ false
+
+
+
+ childDelegation
+ boolean
+ false
+ true
+
+
+
+ classesDirectory
+ java.io.File
+ false
+ true
+ The directory containing generated classes of the project being tested. This will be included after the test classes in the test classpath.
+
+
+ classpathDependencyExcludes
+ java.lang.String[]
+ false
+ true
+
+
+
+ classpathDependencyScopeExclude
+ java.lang.String
+ false
+ true
+
+
+
+ consoleOutputReporter
+ org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter
+ false
+ true
+
+
+
+ debugForkedProcess
+ java.lang.String
+ 2.4
+ false
+ true
+ Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure arbitrary debuggability options (without overwriting the other options specified through the argLine parameter).
+
+
+ dependenciesToScan
+ java.lang.String[]
+ false
+ true
+
+
+
+ disableXmlReport
+ java.lang.Boolean
+ No reason given
+ false
+ true
+
+
+
+ enableAssertions
+ boolean
+ false
+ true
+
+
+
+ enableOutErrElements
+ boolean
+ false
+ true
+
+
+
+ enableProcessChecker
+ java.lang.String
+ 3.0.0-M4
+ false
+ true
+ Since 3.0.0-M4 the process checkers are disabled. You can enable them namely by setting ping and native or all in this parameter.
+The checker is useful in situations when you kill the build on a CI system and you want the Surefire forked JVM to kill the tests asap and free all handlers on the file system been previously used by the JVM and by the tests.
+The ping should be safely used together with ZGC or Shenandoah Garbage Collector. Due to the ping relies on timing of the PING (triggered every 30 seconds), slow GCs may pause the timers and pretend that the parent process of the forked JVM does not exist.
+The native is very fast checker. It is useful mechanism on Unix based systems, Linux distributions and Alpine/BusyBox Linux. See the JIRA SUREFIRE-1631 <https://issues.apache.org/jira/browse/SUREFIRE-1631> for Windows issues.
+Another useful configuration parameter is forkedProcessTimeoutInSeconds.
+See the Frequently Asked Questions page with more details:
+http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm <http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm>
+http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm <http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm>
+Example of use:
+mvn test -Dsurefire.enableProcessChecker=all
+
+
+ enablePropertiesElement
+ boolean
+ false
+ true
+
+
+
+ encoding
+ java.lang.String
+ 3.0.0-M1
+ false
+ true
+ The character encoding scheme to be applied while generating test report files (see target/surefire-reports/yourTestName.txt). The report output files (*-out.txt) are encoded in UTF-8 if not set otherwise.
+
+
+ environmentVariables
+ java.util.Map
+ false
+ true
+
+
+
+ excludeJUnit5Engines
+ java.lang.String[]
+ 3.0.0-M6
+ false
+ true
+ Provide the ID/s of an JUnit engine to be excluded in the test run.
+
+
+ excludedEnvironmentVariables
+ java.lang.String[]
+ 3.0.0-M4
+ false
+ true
+ You can selectively exclude individual environment variables by enumerating their keys.
+The environment is a system-dependent mapping from keys to values which is inherited from the Maven process to the forked Surefire processes. The keys must literally (case sensitive) match in order to exclude their environment variable.
+Example to exclude three environment variables:
+mvn test -Dsurefire.excludedEnvironmentVariables=ACME1,ACME2,ACME3
+
+
+ excludedGroups
+ java.lang.String
+ false
+ true
+
+
+
+ excludes
+ java.util.List
+ false
+ true
+ A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be
+<excludes> <exclude>**/*$*</exclude> </excludes> (which excludes all inner classes).
+This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
+Each exclude item may also contain a comma-separated sub-list of items, which will be treated as multiple <exclude> entries.
+Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): <exclude>%regex[pkg.*Slow.*.class], Unstable*</exclude>
+Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter testClassesDirectory which defaults to the POM property ${project.build.testOutputDirectory}, typically src/test/java unless overridden.
+
+
+ excludesFile
+ java.io.File
+ 2.13
+ false
+ true
+ A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If excludes are also specified, these patterns are appended. Example with path, simple and regex excludes:
+*/test/* **/DontRunTest.* %regex[.*Test.*|.*Not.*] Since 3.0.0-M6, method filtering support is provided in the exclusions file as well, example: pkg.SomeTest#testMethod
+
+
+ failIfNoSpecifiedTests
+ boolean
+ 2.12
+ false
+ true
+ Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to "true".
+
+
+ failIfNoTests
+ boolean
+ false
+ true
+
+
+
+ failOnFlakeCount
+ int
+ 3.0.0-M6
+ false
+ true
+ Set this to a value greater than 0 to fail the whole test set if the cumulative number of flakes reaches this threshold. Set to 0 to allow an unlimited number of flakes.
+
+
+ forkCount
+ java.lang.String
+ false
+ true
+
+
+
+ forkNode
+ org.apache.maven.surefire.extensions.ForkNodeFactory
+ 3.0.0-M5
+ false
+ true
+ This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process pipes or TCP/IP sockets. The plugin uses process pipes by default which will be turned to TCP/IP in the version 3.0.0. Alternatively, you can implement your own factory and SPI.
+See the documentation for more details:
+https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html <https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html>
+
+
+ forkedProcessExitTimeoutInSeconds
+ int
+ 2.20
+ false
+ true
+ Forked process is normally terminated without any significant delay after given tests have completed. If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated by System.exit(). Use this parameter in order to determine the timeout of terminating the process. see the documentation: http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html <http://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html> Turns to default fallback value of 30 seconds if negative integer.
+
+
+ forkedProcessTimeoutInSeconds
+ int
+ 2.4
+ false
+ true
+ Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out.
+
+
+ groups
+ java.lang.String
+ false
+ true
+
+
+
+ includeJUnit5Engines
+ java.lang.String[]
+ 3.0.0-M6
+ false
+ true
+ Provide the ID/s of an JUnit engine to be included in the test run.
+
+
+ includes
+ java.util.List
+ false
+ true
+ A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be <includes> <include>**/Test*.java</include> <include>**/*Test.java</include> <include>**/*Tests.java</include> <include>**/*TestCase.java</include> </includes> Each include item may also contain a comma-separated sub-list of items, which will be treated as multiple <include> entries.
+Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): <include>%regex[.*[Cat|Dog].*], Basic????, !Unstable*</include> <include>%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg/**/*Fast*.java</include>
+This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
+
+Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter testClassesDirectory which defaults to the POM property ${project.build.testOutputDirectory}, typically src/test/java unless overridden.
+
+
+ includesFile
+ java.io.File
+ 2.13
+ false
+ true
+ A file containing include patterns. Blank lines, or lines starting with # are ignored. If includes are also specified, these patterns are appended. Example with path, simple and regex includes: */test/* **/NotIncludedByDefault.java %regex[.*Test.*|.*Not.*]
+Since 3.0.0-M6, method filtering support is provided in the inclusions file as well, example: pkg.SomeTest#testMethod
+
+
+ jdkToolchain
+ java.util.Map
+ false
+ true
+
+
+
+ junitArtifactName
+ java.lang.String
+ false
+ true
+
+
+
+ jvm
+ java.lang.String
+ false
+ true
+
+
+
+ objectFactory
+ java.lang.String
+ false
+ true
+
+
+
+ parallel
+ java.lang.String
+ false
+ true
+
+
+
+ parallelMavenExecution
+ java.lang.Boolean
+ false
+ false
+
+
+
+ parallelOptimized
+ boolean
+ false
+ true
+
+
+
+ parallelTestsTimeoutForcedInSeconds
+ double
+ 2.16
+ false
+ true
+ Stop executing queued parallel JUnit tests and interrupt currently running tests after a certain number of seconds.
+Example values: "3.5", "4"
+
+If set to 0, wait forever, never timing out. Makes sense with specified parallel different from "none".
+
+
+ parallelTestsTimeoutInSeconds
+ double
+ 2.16
+ false
+ true
+ Stop executing queued parallel JUnit tests after a certain number of seconds.
+Example values: "3.5", "4"
+
+If set to 0, wait forever, never timing out. Makes sense with specified parallel different from "none".
+
+
+ perCoreThreadCount
+ boolean
+ false
+ true
+
+
+
+ pluginArtifactMap
+ java.util.Map
+ true
+ false
+
+
+
+ pluginDescriptor
+ org.apache.maven.plugin.descriptor.PluginDescriptor
+ true
+ false
+
+
+
+ printSummary
+ boolean
+ false
+ true
+ Option to print summary of test suites or just print the test cases that have errors.
+
+
+ project
+ org.apache.maven.project.MavenProject
+ true
+ false
+
+
+
+ projectArtifactMap
+ java.util.Map
+ true
+ false
+
+
+
+ projectBuildDirectory
+ java.io.File
+ true
+ false
+
+
+
+ promoteUserPropertiesToSystemProperties
+ boolean
+ false
+ true
+
+
+
+ properties
+ java.util.Properties
+ false
+ true
+
+
+
+ redirectTestOutputToFile
+ boolean
+ false
+ true
+
+
+
+ reportFormat
+ java.lang.String
+ false
+ true
+ Selects the formatting for the test report to be generated. Can be set as "brief" or "plain". Only applies to the output format of the output files (target/surefire-reports/testName.txt)
+
+
+ reportNameSuffix
+ java.lang.String
+ false
+ true
+
+
+
+ reportsDirectory
+ java.io.File
+ false
+ true
+ Base directory where all reports are written to.
+
+
+ rerunFailingTestsCount
+ int
+ false
+ true
+ (JUnit 4+ providers and JUnit 5+ providers since 3.0.0-M4) The number of times each failing test will be rerun. If set larger than 0, rerun failing tests immediately after they fail. If a failing test passes in any of those reruns, it will be marked as pass and reported as a "flake". However, all the failing attempts will be recorded.
+
+
+ reuseForks
+ boolean
+ false
+ true
+
+
+
+ runOrder
+ java.lang.String
+ 2.7
+ false
+ true
+ Defines the order the tests will be run in. Supported values are alphabetical, reversealphabetical, random, hourly (alphabetical on even hours, reverse alphabetical on odd hours), failedfirst, balanced and filesystem.
+
+Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a multi-module build.
+
+Failed first will run tests that failed on previous run first, as well as new tests for this run.
+
+Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the overall execution time. Initially a statistics file is created and every next test run will reorder classes.
+
+Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml and should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different configurations will have different statistics files, meaning if you change any configuration settings you will re-run once before new statistics data can be established.
+
+
+ runOrderRandomSeed
+ java.lang.Long
+ 3.0.0-M6
+ false
+ true
+ Sets the random seed that will be used to order the tests if surefire.runOrder is set to random.
+
+If no seeds are set and surefire.runOrder is set to random, then the seed used will be outputted (search for "To reproduce ordering use flag -Dsurefire.runOrder.random.seed").
+
+To deterministically reproduce any random test order that was run before, simply set the seed to be the same value.
+
+
+ session
+ org.apache.maven.execution.MavenSession
+ true
+ false
+
+
+
+ shutdown
+ java.lang.String
+ 2.19
+ false
+ true
+ After the plugin process is shutdown by sending SIGTERM signal (CTRL+C), SHUTDOWN command is received by every forked JVM.
+The value is set to (shutdown=exit) by default (changed in version 3.0.0-M4).
+The parameter can be configured with other two values testset and kill.
+With(shutdown=testset) the test set may still continue to run in forked JVM.
+Using exit forked JVM executes System.exit(1) after the plugin process has received SIGTERM signal.
+Using kill the JVM executes Runtime.halt(1) and kills itself.
+
+
+ skip
+ boolean
+ false
+ true
+
+
+
+ skipAfterFailureCount
+ int
+ 2.19
+ false
+ true
+ Set to error/failure count in order to skip remaining tests. Due to race conditions in parallel/forked execution this may not be fully guaranteed.
+Enable with system property -Dsurefire.skipAfterFailureCount=1 or any number greater than zero. Defaults to "0".
+See the prerequisites and limitations in documentation:
+http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html <http://maven.apache.org/plugins/maven-surefire-plugin/examples/skip-after-failure.html>
+
+
+ skipExec
+ boolean
+ No reason given
+ false
+ true
+
+
+
+ skipTests
+ boolean
+ false
+ true
+
+
+
+ statelessTestsetInfoReporter
+ org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter
+ false
+ true
+
+
+
+ statelessTestsetReporter
+ org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter
+ false
+ true
+
+
+
+ suiteXmlFiles
+ java.io.File[]
+ 2.2
+ false
+ true
+ (TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that suiteXmlFiles is incompatible with several other parameters of this plugin, like includes and excludes.
+This parameter is ignored if the test parameter is specified (allowing you to run a single test instead of an entire suite).
+
+
+ systemProperties
+ java.util.Properties
+ No reason given
+ false
+ true
+
+
+
+ systemPropertiesFile
+ java.io.File
+ false
+ true
+ Properties file being used as system properties passed to the provider.
+See also: AbstractSurefireMojo#systemPropertyVariables systemPropertyVariables for how the effective provider properties are calculated
+
+
+ systemPropertyVariables
+ java.util.Map
+ false
+ true
+
+
+
+ tempDir
+ java.lang.String
+ false
+ true
+
+
+
+ test
+ java.lang.String
+ false
+ true
+ Specify this parameter to run individual tests by file name, overriding the parameter includes and excludes. Each pattern you specify here will be used to create an include pattern formatted like **/${test}.java, so you can just type -Dtest=MyTest to run a single test called "foo/MyTest.java". The test patterns prefixed with a ! will be excluded.
+This parameter overrides the parameter includes, excludes, and the TestNG parameter suiteXmlFiles.
+Since 2.7.3, you can execute a limited number of methods in the test by adding #myMethod or #my*ethod. For example, -Dtest=MyTest#myMethod. This is supported for junit 4.x and TestNg.
+
+Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): "-Dtest=???Test, !Unstable*, pkg/**/Ci*leTest.java, *Test#test*One+testTwo?????, #fast*+slowTest" or e.g. "-Dtest=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyTest.class#one.*|two.*], %regex[#fast.*|slow.*]"
+The Parameterized JUnit runner describes test methods using an index in brackets, so the non-regex method pattern would become: #testMethod[*]. If using @Parameters(name="{index}: fib({0})={1}") and selecting the index e.g. 5 in pattern, the non-regex method pattern would become #testMethod[5:*].
+
+
+ testClassesDirectory
+ java.io.File
+ false
+ true
+
+
+
+ testFailureIgnore
+ boolean
+ false
+ true
+ Set this to "true" to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
+
+
+ testNGArtifactName
+ java.lang.String
+ false
+ true
+
+
+
+ testSourceDirectory
+ java.io.File
+ false
+ true
+
+
+
+ threadCount
+ int
+ false
+ true
+
+
+
+ threadCountClasses
+ int
+ false
+ true
+
+
+
+ threadCountMethods
+ int
+ false
+ true
+
+
+
+ threadCountSuites
+ int
+ false
+ true
+
+
+
+ trimStackTrace
+ boolean
+ false
+ true
+
+
+
+ useFile
+ boolean
+ false
+ true
+ Option to generate a file test report or just output the test report to the console.
+
+
+ useManifestOnlyJar
+ boolean
+ 2.4.3
+ false
+ true
+ By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to launch your tests with a plain old Java classpath. (See the http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html <http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html> for a more detailed explanation of manifest-only JARs and their benefits.)
+Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
+
+
+ useModulePath
+ boolean
+ 3.0.0-M2
+ false
+ true
+ When true, uses the modulepath when executing with JDK 9+ and module-info.java is present. When false, always uses the classpath.
+Defaults to true.
+
+
+ useSystemClassLoader
+ boolean
+ 2.3
+ false
+ true
+ Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's ClassLoader.
+
+
+ useUnlimitedThreads
+ boolean
+ false
+ true
+
+
+
+ workingDirectory
+ java.io.File
+ false
+ true
+
+
+
+
+ ${maven.test.additionalClasspathDependencies}
+ ${maven.test.additionalClasspath}
+ ${argLine}
+
+ ${childDelegation}
+
+ ${maven.test.dependency.excludes}
+ ${maven.surefire.debug}
+ ${dependenciesToScan}
+ ${disableXmlReport}
+ ${enableAssertions}
+ ${enableOutErrElements}
+ ${surefire.enableProcessChecker}
+ ${enablePropertiesElement}
+ ${surefire.encoding}
+ ${surefire.excludeJUnit5Engines}
+ ${surefire.excludedEnvironmentVariables}
+ ${excludedGroups}
+ ${surefire.excludes}
+ ${surefire.excludesFile}
+ ${surefire.failIfNoSpecifiedTests}
+ ${failIfNoTests}
+ ${surefire.failOnFlakeCount}
+ ${forkCount}
+ ${surefire.forkNode}
+ ${surefire.exitTimeout}
+ ${surefire.timeout}
+ ${groups}
+ ${surefire.includeJUnit5Engines}
+ ${surefire.includes}
+ ${surefire.includesFile}
+ ${junitArtifactName}
+ ${jvm}
+ ${objectFactory}
+ ${parallel}
+
+ ${parallelOptimized}
+ ${surefire.parallel.forcedTimeout}
+ ${surefire.parallel.timeout}
+ ${perCoreThreadCount}
+ ${plugin.artifactMap}
+
+ ${surefire.printSummary}
+
+ ${project.artifactMap}
+
+
+ ${maven.test.redirectTestOutputToFile}
+ ${surefire.reportFormat}
+ ${surefire.reportNameSuffix}
+
+ ${surefire.rerunFailingTestsCount}
+ ${reuseForks}
+ ${surefire.runOrder}
+ ${surefire.runOrder.random.seed}
+
+ ${surefire.shutdown}
+ ${maven.test.skip}
+ ${surefire.skipAfterFailureCount}
+ ${maven.test.skip.exec}
+ ${skipTests}
+ ${surefire.suiteXmlFiles}
+ ${surefire.systemPropertiesFile}
+ ${tempDir}
+ ${test}
+
+ ${maven.test.failure.ignore}
+ ${testNGArtifactName}
+
+ ${threadCount}
+ ${threadCountClasses}
+ ${threadCountMethods}
+ ${threadCountSuites}
+ ${trimStackTrace}
+ ${surefire.useFile}
+ ${surefire.useManifestOnlyJar}
+ ${surefire.useModulePath}
+ ${surefire.useSystemClassLoader}
+ ${useUnlimitedThreads}
+ ${basedir}
+
+
+
+ org.codehaus.plexus.languages.java.jpms.LocationManager
+ locationManager
+
+
+ org.codehaus.plexus.logging.Logger
+ logger
+
+
+ org.apache.maven.surefire.providerapi.ProviderDetector
+ providerDetector
+
+
+ org.apache.maven.plugin.surefire.SurefireDependencyResolver
+ surefireDependencyResolver
+
+
+ org.apache.maven.toolchain.ToolchainManager
+ toolchainManager
+
+
+
+
+
+
+ org.apache.maven.surefire
+ surefire-api
+ jar
+ 3.5.2
+
+
+ org.apache.maven.shared
+ maven-shared-utils
+ jar
+ 3.3.4
+
+
+ commons-io
+ commons-io
+ jar
+ 2.17.0
+
+
+ org.slf4j
+ slf4j-api
+ jar
+ 1.7.36
+
+
+ org.apache.maven.surefire
+ surefire-logger-api
+ jar
+ 3.5.2
+
+
+ org.apache.commons
+ commons-lang3
+ jar
+ 3.17.0
+
+
+ org.apache.maven.surefire
+ surefire-extensions-api
+ jar
+ 3.5.2
+
+
+ org.apache.maven.surefire
+ maven-surefire-common
+ jar
+ 3.5.2
+
+
+ org.codehaus.plexus
+ plexus-java
+ jar
+ 1.3.0
+
+
+ org.ow2.asm
+ asm
+ jar
+ 9.6
+
+
+ com.thoughtworks.qdox
+ qdox
+ jar
+ 2.0.3
+
+
+ org.apache.commons
+ commons-compress
+ jar
+ 1.27.1
+
+
+ commons-codec
+ commons-codec
+ jar
+ 1.16.1
+
+
+ org.apache.maven.resolver
+ maven-resolver-util
+ jar
+ 1.4.1
+
+
+ org.apache.maven.resolver
+ maven-resolver-api
+ jar
+ 1.9.22
+
+
+ org.apache.maven.surefire
+ surefire-booter
+ jar
+ 3.5.2
+
+
+ org.apache.maven.surefire
+ surefire-extensions-spi
+ jar
+ 3.5.2
+
+
+ org.apache.maven.shared
+ maven-common-artifact-filters
+ jar
+ 3.4.0
+
+
+
diff -urEbwBN a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_plugin/HelpMojo.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_plugin/HelpMojo.java
--- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_plugin/HelpMojo.java 1970-01-01 01:00:00.000000000 +0100
+++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_plugin/HelpMojo.java 2024-11-04 10:41:36.879493528 +0100
@@ -0,0 +1,448 @@
+package org.apache.maven.plugins.maven_surefire_plugin;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Display help information on maven-surefire-plugin.
+ * Call mvn surefire:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.
+ * @author maven-plugin-tools
+ */
+@Mojo( name = "help", requiresProject = false, threadSafe = true )
+public class HelpMojo
+ extends AbstractMojo
+{
+ /**
+ * If true
, display all settable properties for each goal.
+ *
+ */
+ @Parameter( property = "detail", defaultValue = "false" )
+ private boolean detail;
+
+ /**
+ * The name of the goal for which to show help. If unspecified, all goals will be displayed.
+ *
+ */
+ @Parameter( property = "goal" )
+ private java.lang.String goal;
+
+ /**
+ * The maximum length of a display line, should be positive.
+ *
+ */
+ @Parameter( property = "lineLength", defaultValue = "80" )
+ private int lineLength;
+
+ /**
+ * The number of spaces per indentation level, should be positive.
+ *
+ */
+ @Parameter( property = "indentSize", defaultValue = "2" )
+ private int indentSize;
+
+ // /META-INF/maven///plugin-help.xml
+ private static final String PLUGIN_HELP_PATH =
+ "/META-INF/maven/org.apache.maven.plugins/maven-surefire-plugin/plugin-help.xml";
+
+ private static final int DEFAULT_LINE_LENGTH = 80;
+
+ private Document build()
+ throws MojoExecutionException
+ {
+ getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH );
+ try ( InputStream is = getClass().getResourceAsStream( PLUGIN_HELP_PATH ) )
+ {
+ if ( is == null )
+ {
+ throw new MojoExecutionException( "Could not find plugin descriptor at " + PLUGIN_HELP_PATH );
+ }
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ return dBuilder.parse( is );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ catch ( ParserConfigurationException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ catch ( SAXException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( lineLength <= 0 )
+ {
+ getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
+ lineLength = DEFAULT_LINE_LENGTH;
+ }
+ if ( indentSize <= 0 )
+ {
+ getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
+ indentSize = 2;
+ }
+
+ Document doc = build();
+
+ StringBuilder sb = new StringBuilder();
+ Node plugin = getSingleChild( doc, "plugin" );
+
+
+ String name = getValue( plugin, "name" );
+ String version = getValue( plugin, "version" );
+ String id = getValue( plugin, "groupId" ) + ":" + getValue( plugin, "artifactId" ) + ":" + version;
+ if ( isNotEmpty( name ) && !name.contains( id ) )
+ {
+ append( sb, name + " " + version, 0 );
+ }
+ else
+ {
+ if ( isNotEmpty( name ) )
+ {
+ append( sb, name, 0 );
+ }
+ else
+ {
+ append( sb, id, 0 );
+ }
+ }
+ append( sb, getValue( plugin, "description" ), 1 );
+ append( sb, "", 0 );
+
+ //plugin
+ String goalPrefix = getValue( plugin, "goalPrefix" );
+
+ Node mojos1 = getSingleChild( plugin, "mojos" );
+
+ List mojos = findNamedChild( mojos1, "mojo" );
+
+ if ( goal == null || goal.length() <= 0 )
+ {
+ append( sb, "This plugin has " + mojos.size() + ( mojos.size() > 1 ? " goals:" : " goal:" ), 0 );
+ append( sb, "", 0 );
+ }
+
+ for ( Node mojo : mojos )
+ {
+ writeGoal( sb, goalPrefix, (Element) mojo );
+ }
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( sb.toString() );
+ }
+ }
+
+
+ private static boolean isNotEmpty( String string )
+ {
+ return string != null && string.length() > 0;
+ }
+
+ private static String getValue( Node node, String elementName )
+ throws MojoExecutionException
+ {
+ return getSingleChild( node, elementName ).getTextContent();
+ }
+
+ private static Node getSingleChild( Node node, String elementName )
+ throws MojoExecutionException
+ {
+ List namedChild = findNamedChild( node, elementName );
+ if ( namedChild.isEmpty() )
+ {
+ throw new MojoExecutionException( "Could not find " + elementName + " in plugin-help.xml" );
+ }
+ if ( namedChild.size() > 1 )
+ {
+ throw new MojoExecutionException( "Multiple " + elementName + " in plugin-help.xml" );
+ }
+ return namedChild.get( 0 );
+ }
+
+ private static List findNamedChild( Node node, String elementName )
+ {
+ List result = new ArrayList();
+ NodeList childNodes = node.getChildNodes();
+ for ( int i = 0; i < childNodes.getLength(); i++ )
+ {
+ Node item = childNodes.item( i );
+ if ( elementName.equals( item.getNodeName() ) )
+ {
+ result.add( item );
+ }
+ }
+ return result;
+ }
+
+ private static Node findSingleChild( Node node, String elementName )
+ throws MojoExecutionException
+ {
+ List elementsByTagName = findNamedChild( node, elementName );
+ if ( elementsByTagName.isEmpty() )
+ {
+ return null;
+ }
+ if ( elementsByTagName.size() > 1 )
+ {
+ throw new MojoExecutionException( "Multiple " + elementName + "in plugin-help.xml" );
+ }
+ return elementsByTagName.get( 0 );
+ }
+
+ private void writeGoal( StringBuilder sb, String goalPrefix, Element mojo )
+ throws MojoExecutionException
+ {
+ String mojoGoal = getValue( mojo, "goal" );
+ Node configurationElement = findSingleChild( mojo, "configuration" );
+ Node description = findSingleChild( mojo, "description" );
+ if ( goal == null || goal.length() <= 0 || mojoGoal.equals( goal ) )
+ {
+ append( sb, goalPrefix + ":" + mojoGoal, 0 );
+ Node deprecated = findSingleChild( mojo, "deprecated" );
+ if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) )
+ {
+ append( sb, "Deprecated. " + deprecated.getTextContent(), 1 );
+ if ( detail && description != null )
+ {
+ append( sb, "", 0 );
+ append( sb, description.getTextContent(), 1 );
+ }
+ }
+ else if ( description != null )
+ {
+ append( sb, description.getTextContent(), 1 );
+ }
+ append( sb, "", 0 );
+
+ if ( detail )
+ {
+ Node parametersNode = getSingleChild( mojo, "parameters" );
+ List parameters = findNamedChild( parametersNode, "parameter" );
+ append( sb, "Available parameters:", 1 );
+ append( sb, "", 0 );
+
+ for ( Node parameter : parameters )
+ {
+ writeParameter( sb, parameter, configurationElement );
+ }
+ }
+ }
+ }
+
+ private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement )
+ throws MojoExecutionException
+ {
+ String parameterName = getValue( parameter, "name" );
+ String parameterDescription = getValue( parameter, "description" );
+
+ Element fieldConfigurationElement = null;
+ if ( configurationElement != null )
+ {
+ fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName );
+ }
+
+ String parameterDefaultValue = "";
+ if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) )
+ {
+ parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")";
+ }
+ append( sb, parameterName + parameterDefaultValue, 2 );
+ Node deprecated = findSingleChild( parameter, "deprecated" );
+ if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) )
+ {
+ append( sb, "Deprecated. " + deprecated.getTextContent(), 3 );
+ append( sb, "", 0 );
+ }
+ if ( isNotEmpty( parameterDescription ) ) {
+ append( sb, parameterDescription, 3 );
+ }
+ if ( "true".equals( getValue( parameter, "required" ) ) )
+ {
+ append( sb, "Required: Yes", 3 );
+ }
+ if ( ( fieldConfigurationElement != null ) && isNotEmpty( fieldConfigurationElement.getTextContent() ) )
+ {
+ String property = getPropertyFromExpression( fieldConfigurationElement.getTextContent() );
+ append( sb, "User property: " + property, 3 );
+ }
+
+ append( sb, "", 0 );
+ }
+
+ /**
+ * Repeat a String n
times to form a new string.
+ *
+ * @param str String to repeat
+ * @param repeat number of times to repeat str
+ * @return String with repeated String
+ * @throws NegativeArraySizeException if repeat < 0
+ * @throws NullPointerException if str is null
+ */
+ private static String repeat( String str, int repeat )
+ {
+ StringBuilder buffer = new StringBuilder( repeat * str.length() );
+
+ for ( int i = 0; i < repeat; i++ )
+ {
+ buffer.append( str );
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ * Append a description to the buffer by respecting the indentSize and lineLength parameters.
+ * Note: The last character is always a new line.
+ *
+ * @param sb The buffer to append the description, not null
.
+ * @param description The description, not null
.
+ * @param indent The base indentation level of each line, must not be negative.
+ */
+ private void append( StringBuilder sb, String description, int indent )
+ {
+ for ( String line : toLines( description, indent, indentSize, lineLength ) )
+ {
+ sb.append( line ).append( '\n' );
+ }
+ }
+
+ /**
+ * Splits the specified text into lines of convenient display length.
+ *
+ * @param text The text to split into lines, must not be null
.
+ * @param indent The base indentation level of each line, must not be negative.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ * @return The sequence of display lines, never null
.
+ * @throws NegativeArraySizeException if indent < 0
+ */
+ private static List toLines( String text, int indent, int indentSize, int lineLength )
+ {
+ List lines = new ArrayList();
+
+ String ind = repeat( "\t", indent );
+
+ String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
+
+ for ( String plainLine : plainLines )
+ {
+ toLines( lines, ind + plainLine, indentSize, lineLength );
+ }
+
+ return lines;
+ }
+
+ /**
+ * Adds the specified line to the output sequence, performing line wrapping if necessary.
+ *
+ * @param lines The sequence of display lines, must not be null
.
+ * @param line The line to add, must not be null
.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ */
+ private static void toLines( List lines, String line, int indentSize, int lineLength )
+ {
+ int lineIndent = getIndentLevel( line );
+ StringBuilder buf = new StringBuilder( 256 );
+
+ String[] tokens = line.split( " +" );
+
+ for ( String token : tokens )
+ {
+ if ( buf.length() > 0 )
+ {
+ if ( buf.length() + token.length() >= lineLength )
+ {
+ lines.add( buf.toString() );
+ buf.setLength( 0 );
+ buf.append( repeat( " ", lineIndent * indentSize ) );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+ }
+
+ for ( int j = 0; j < token.length(); j++ )
+ {
+ char c = token.charAt( j );
+ if ( c == '\t' )
+ {
+ buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
+ }
+ else if ( c == '\u00A0' )
+ {
+ buf.append( ' ' );
+ }
+ else
+ {
+ buf.append( c );
+ }
+ }
+ }
+ lines.add( buf.toString() );
+ }
+
+ /**
+ * Gets the indentation level of the specified line.
+ *
+ * @param line The line whose indentation level should be retrieved, must not be null
.
+ * @return The indentation level of the line.
+ */
+ private static int getIndentLevel( String line )
+ {
+ int level = 0;
+ for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
+ {
+ level++;
+ }
+ for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
+ {
+ if ( line.charAt( i ) == '\t' )
+ {
+ level++;
+ break;
+ }
+ }
+ return level;
+ }
+
+ private static String getPropertyFromExpression( String expression )
+ {
+ if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" )
+ && !expression.substring( 2 ).contains( "${" ) )
+ {
+ // expression="${xxx}" -> property="xxx"
+ return expression.substring( 2, expression.length() - 1 );
+ }
+ // no property can be extracted
+ return null;
+ }
+}
diff -urEbwBN a/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-report-plugin/plugin-help.xml b/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-report-plugin/plugin-help.xml
--- a/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-report-plugin/plugin-help.xml 1970-01-01 01:00:00.000000000 +0100
+++ b/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-surefire-report-plugin/plugin-help.xml 2024-11-04 10:45:39.894480900 +0100
@@ -0,0 +1,496 @@
+
+
+
+
+
+ ${project.name}
+ ${project.description}
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ surefire-report
+
+
+ failsafe-report-only
+ Creates a nicely formatted Failsafe Test Report in html format. This goal does not run the tests, it only builds the reports. See https://issues.apache.org/jira/browse/SUREFIRE-257 <https://issues.apache.org/jira/browse/SUREFIRE-257>
+ false
+ true
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.surefire.report.FailsafeOnlyReport
+ java
+ per-lookup
+ once-per-session
+ 2.10
+ false
+
+
+ aggregate
+ boolean
+ false
+ true
+ Whether to build an aggregated report at the root, or build individual reports.
+
+
+ alwaysGenerateFailsafeReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the failsafe report will be generated even when there are no failsafe result files. Defaults to false to preserve legacy behaviour pre 2.10.
+
+
+ customBundle
+ java.lang.String
+ 3.1.0
+ false
+ true
+ Path for a custom bundle instead of using the default one.
+Using this field, you could change the texts in the generated reports.
+
+
+ linkXRef
+ boolean
+ false
+ true
+ Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
+
+
+ locale
+ java.lang.String
+ false
+ true
+
+
+
+ outputDirectory
+ java.io.File
+ true
+ true
+
+
+
+ outputFormat
+ java.lang.String
+ false
+ true
+
+
+
+ outputName
+ java.lang.String
+ true
+ true
+ The filename to use for the report.
+
+
+ outputTimestamp
+ java.lang.String
+ false
+ true
+
+
+
+ reportsDirectories
+ java.io.File[]
+ false
+ true
+ Directories containing the XML Report files that will be parsed and rendered to HTML format.
+
+
+ reportsDirectory
+ java.io.File
+ No reason given
+ false
+ true
+ (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
+
+
+ showSuccess
+ boolean
+ true
+ true
+ If set to false, only failures are shown.
+
+
+ siteDirectory
+ java.io.File
+ false
+ true
+
+
+
+ skipFailsafeReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the failsafe report generation will be skipped.
+
+
+ xrefTestLocation
+ java.io.File
+ false
+ true
+ Location where Test Source XRef is generated for this project.
+Default: org.apache.maven.reporting.AbstractMavenReport.getReportOutputDirectory() + /xref-test
+
+
+
+ ${aggregate}
+ ${alwaysGenerateFailsafeReport}
+
+ ${linkXRef}
+
+
+ ${output.format}
+ ${outputName}
+
+ ${showSuccess}
+
+ ${skipFailsafeReport}
+
+
+
+ help
+ Display help information on maven-surefire-report-plugin.
+Call mvn surefire-report:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
+ false
+ false
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.maven_surefire_report_plugin.HelpMojo
+ java
+ per-lookup
+ once-per-session
+ true
+
+
+ detail
+ boolean
+ false
+ true
+ If true, display all settable properties for each goal.
+
+
+ goal
+ java.lang.String
+ false
+ true
+ The name of the goal for which to show help. If unspecified, all goals will be displayed.
+
+
+ indentSize
+ int
+ false
+ true
+ The number of spaces per indentation level, should be positive.
+
+
+ lineLength
+ int
+ false
+ true
+ The maximum length of a display line, should be positive.
+
+
+
+ ${detail}
+ ${goal}
+ ${indentSize}
+ ${lineLength}
+
+
+
+ report
+ Creates a nicely formatted Surefire Test Report in html format.
+ false
+ true
+ false
+ false
+ false
+ false
+ test
+ surefire
+ org.apache.maven.plugins.surefire.report.SurefireReport
+ java
+ per-lookup
+ once-per-session
+ false
+
+
+ aggregate
+ boolean
+ false
+ true
+ Whether to build an aggregated report at the root, or build individual reports.
+
+
+ alwaysGenerateSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report will be generated even when there are no surefire result files. Defaults to true to preserve legacy behaviour pre 2.10.
+
+
+ customBundle
+ java.lang.String
+ 3.1.0
+ false
+ true
+ Path for a custom bundle instead of using the default one.
+Using this field, you could change the texts in the generated reports.
+
+
+ linkXRef
+ boolean
+ false
+ true
+ Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
+
+
+ locale
+ java.lang.String
+ false
+ true
+
+
+
+ outputDirectory
+ java.io.File
+ true
+ true
+
+
+
+ outputFormat
+ java.lang.String
+ false
+ true
+
+
+
+ outputName
+ java.lang.String
+ true
+ true
+ The filename to use for the report.
+
+
+ outputTimestamp
+ java.lang.String
+ false
+ true
+
+
+
+ reportsDirectories
+ java.io.File[]
+ false
+ true
+ Directories containing the XML Report files that will be parsed and rendered to HTML format.
+
+
+ reportsDirectory
+ java.io.File
+ No reason given
+ false
+ true
+ (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
+
+
+ showSuccess
+ boolean
+ true
+ true
+ If set to false, only failures are shown.
+
+
+ siteDirectory
+ java.io.File
+ false
+ true
+
+
+
+ skipSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report generation will be skipped.
+
+
+ xrefTestLocation
+ java.io.File
+ false
+ true
+ Location where Test Source XRef is generated for this project.
+Default: org.apache.maven.reporting.AbstractMavenReport.getReportOutputDirectory() + /xref-test
+
+
+
+ ${aggregate}
+ ${alwaysGenerateSurefireReport}
+
+ ${linkXRef}
+
+
+ ${output.format}
+ ${outputName}
+
+ ${showSuccess}
+
+ ${skipSurefireReport}
+
+
+
+ report-only
+ Creates a nicely formatted Surefire Test Report in html format. This goal does not run the tests, it only builds the reports. This is a workaround for https://issues.apache.org/jira/browse/SUREFIRE-257 <https://issues.apache.org/jira/browse/SUREFIRE-257>
+ false
+ true
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.surefire.report.SurefireOnlyReport
+ java
+ per-lookup
+ once-per-session
+ 2.3
+ false
+
+
+ aggregate
+ boolean
+ false
+ true
+ Whether to build an aggregated report at the root, or build individual reports.
+
+
+ alwaysGenerateSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report will be generated even when there are no surefire result files. Defaults to true to preserve legacy behaviour pre 2.10.
+
+
+ customBundle
+ java.lang.String
+ 3.1.0
+ false
+ true
+ Path for a custom bundle instead of using the default one.
+Using this field, you could change the texts in the generated reports.
+
+
+ linkXRef
+ boolean
+ false
+ true
+ Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
+
+
+ locale
+ java.lang.String
+ false
+ true
+
+
+
+ outputDirectory
+ java.io.File
+ true
+ true
+
+
+
+ outputFormat
+ java.lang.String
+ false
+ true
+
+
+
+ outputName
+ java.lang.String
+ true
+ true
+ The filename to use for the report.
+
+
+ outputTimestamp
+ java.lang.String
+ false
+ true
+
+
+
+ reportsDirectories
+ java.io.File[]
+ false
+ true
+ Directories containing the XML Report files that will be parsed and rendered to HTML format.
+
+
+ reportsDirectory
+ java.io.File
+ No reason given
+ false
+ true
+ (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
+
+
+ showSuccess
+ boolean
+ true
+ true
+ If set to false, only failures are shown.
+
+
+ siteDirectory
+ java.io.File
+ false
+ true
+
+
+
+ skipSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report generation will be skipped.
+
+
+ xrefTestLocation
+ java.io.File
+ false
+ true
+ Location where Test Source XRef is generated for this project.
+Default: org.apache.maven.reporting.AbstractMavenReport.getReportOutputDirectory() + /xref-test
+
+
+
+ ${aggregate}
+ ${alwaysGenerateSurefireReport}
+
+ ${linkXRef}
+
+
+ ${output.format}
+ ${outputName}
+
+ ${showSuccess}
+
+ ${skipSurefireReport}
+
+
+
+
diff -urEbwBN a/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml b/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml
--- a/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml 1970-01-01 01:00:00.000000000 +0100
+++ b/maven-surefire-report-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml 2024-11-04 10:46:55.558333020 +0100
@@ -0,0 +1,958 @@
+
+
+
+
+
+ ${project.name}
+ ${project.description}
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ surefire-report
+ false
+ true
+ 1.8
+ 3.6.3
+
+
+ failsafe-report-only
+ Creates a nicely formatted Failsafe Test Report in html format. This goal does not run the tests, it only builds the reports. See https://issues.apache.org/jira/browse/SUREFIRE-257 <https://issues.apache.org/jira/browse/SUREFIRE-257>
+ false
+ true
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.surefire.report.FailsafeOnlyReport
+ java
+ per-lookup
+ once-per-session
+ 2.10
+ false
+
+
+ aggregate
+ boolean
+ false
+ true
+ Whether to build an aggregated report at the root, or build individual reports.
+
+
+ alwaysGenerateFailsafeReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the failsafe report will be generated even when there are no failsafe result files. Defaults to false to preserve legacy behaviour pre 2.10.
+
+
+ customBundle
+ java.lang.String
+ 3.1.0
+ false
+ true
+ Path for a custom bundle instead of using the default one.
+Using this field, you could change the texts in the generated reports.
+
+
+ inputEncoding
+ java.lang.String
+ false
+ false
+
+
+
+ linkXRef
+ boolean
+ false
+ true
+ Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
+
+
+ locale
+ java.lang.String
+ false
+ true
+
+
+
+ mojoExecution
+ org.apache.maven.plugin.MojoExecution
+ true
+ false
+
+
+
+ outputDirectory
+ java.io.File
+ true
+ true
+
+
+
+ outputEncoding
+ java.lang.String
+ false
+ false
+
+
+
+ outputFormat
+ java.lang.String
+ false
+ true
+
+
+
+ outputName
+ java.lang.String
+ true
+ true
+ The filename to use for the report.
+
+
+ outputTimestamp
+ java.lang.String
+ false
+ true
+
+
+
+ project
+ org.apache.maven.project.MavenProject
+ true
+ false
+
+
+
+ reactorProjects
+ java.util.List
+ true
+ false
+
+
+
+ remoteProjectRepositories
+ java.util.List
+ true
+ false
+
+
+
+ repoSession
+ org.eclipse.aether.RepositorySystemSession
+ true
+ false
+
+
+
+ reportsDirectories
+ java.io.File[]
+ false
+ true
+ Directories containing the XML Report files that will be parsed and rendered to HTML format.
+
+
+ reportsDirectory
+ java.io.File
+ No reason given
+ false
+ true
+ (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
+
+
+ settings
+ org.apache.maven.settings.Settings
+ true
+ false
+ The current user system settings for use in Maven.
+
+
+ showSuccess
+ boolean
+ true
+ true
+ If set to false, only failures are shown.
+
+
+ siteDirectory
+ java.io.File
+ false
+ true
+
+
+
+ skipFailsafeReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the failsafe report generation will be skipped.
+
+
+ xrefTestLocation
+ java.io.File
+ false
+ true
+ Location where Test Source XRef is generated for this project.
+Default: org.apache.maven.reporting.AbstractMavenReport.getReportOutputDirectory() + /xref-test
+
+
+
+ ${aggregate}
+ ${alwaysGenerateFailsafeReport}
+
+ ${encoding}
+ ${linkXRef}
+
+
+
+ ${outputEncoding}
+ ${output.format}
+ ${outputName}
+
+
+
+
+
+
+ ${showSuccess}
+
+ ${skipFailsafeReport}
+
+
+
+ org.codehaus.plexus.PlexusContainer
+ container
+
+
+ org.codehaus.plexus.i18n.I18N
+ i18n
+
+
+ org.apache.maven.doxia.siterenderer.Renderer
+ siteRenderer
+
+
+ org.apache.maven.doxia.tools.SiteTool
+ siteTool
+
+
+
+
+ help
+ Display help information on maven-surefire-report-plugin.
+Call mvn surefire-report:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
+ false
+ false
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.maven_surefire_report_plugin.HelpMojo
+ java
+ per-lookup
+ once-per-session
+ true
+
+
+ detail
+ boolean
+ false
+ true
+ If true, display all settable properties for each goal.
+
+
+ goal
+ java.lang.String
+ false
+ true
+ The name of the goal for which to show help. If unspecified, all goals will be displayed.
+
+
+ indentSize
+ int
+ false
+ true
+ The number of spaces per indentation level, should be positive.
+
+
+ lineLength
+ int
+ false
+ true
+ The maximum length of a display line, should be positive.
+
+
+
+ ${detail}
+ ${goal}
+ ${indentSize}
+ ${lineLength}
+
+
+
+ report
+ Creates a nicely formatted Surefire Test Report in html format.
+ false
+ true
+ false
+ false
+ false
+ false
+ test
+ surefire
+ org.apache.maven.plugins.surefire.report.SurefireReport
+ java
+ per-lookup
+ once-per-session
+ false
+
+
+ aggregate
+ boolean
+ false
+ true
+ Whether to build an aggregated report at the root, or build individual reports.
+
+
+ alwaysGenerateSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report will be generated even when there are no surefire result files. Defaults to true to preserve legacy behaviour pre 2.10.
+
+
+ customBundle
+ java.lang.String
+ 3.1.0
+ false
+ true
+ Path for a custom bundle instead of using the default one.
+Using this field, you could change the texts in the generated reports.
+
+
+ inputEncoding
+ java.lang.String
+ false
+ false
+
+
+
+ linkXRef
+ boolean
+ false
+ true
+ Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
+
+
+ locale
+ java.lang.String
+ false
+ true
+
+
+
+ mojoExecution
+ org.apache.maven.plugin.MojoExecution
+ true
+ false
+
+
+
+ outputDirectory
+ java.io.File
+ true
+ true
+
+
+
+ outputEncoding
+ java.lang.String
+ false
+ false
+
+
+
+ outputFormat
+ java.lang.String
+ false
+ true
+
+
+
+ outputName
+ java.lang.String
+ true
+ true
+ The filename to use for the report.
+
+
+ outputTimestamp
+ java.lang.String
+ false
+ true
+
+
+
+ project
+ org.apache.maven.project.MavenProject
+ true
+ false
+
+
+
+ reactorProjects
+ java.util.List
+ true
+ false
+
+
+
+ remoteProjectRepositories
+ java.util.List
+ true
+ false
+
+
+
+ repoSession
+ org.eclipse.aether.RepositorySystemSession
+ true
+ false
+
+
+
+ reportsDirectories
+ java.io.File[]
+ false
+ true
+ Directories containing the XML Report files that will be parsed and rendered to HTML format.
+
+
+ reportsDirectory
+ java.io.File
+ No reason given
+ false
+ true
+ (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
+
+
+ settings
+ org.apache.maven.settings.Settings
+ true
+ false
+ The current user system settings for use in Maven.
+
+
+ showSuccess
+ boolean
+ true
+ true
+ If set to false, only failures are shown.
+
+
+ siteDirectory
+ java.io.File
+ false
+ true
+
+
+
+ skipSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report generation will be skipped.
+
+
+ xrefTestLocation
+ java.io.File
+ false
+ true
+ Location where Test Source XRef is generated for this project.
+Default: org.apache.maven.reporting.AbstractMavenReport.getReportOutputDirectory() + /xref-test
+
+
+
+ ${aggregate}
+ ${alwaysGenerateSurefireReport}
+
+ ${encoding}
+ ${linkXRef}
+
+
+
+ ${outputEncoding}
+ ${output.format}
+ ${outputName}
+
+
+
+
+
+
+ ${showSuccess}
+
+ ${skipSurefireReport}
+
+
+
+ org.codehaus.plexus.PlexusContainer
+ container
+
+
+ org.codehaus.plexus.i18n.I18N
+ i18n
+
+
+ org.apache.maven.doxia.siterenderer.Renderer
+ siteRenderer
+
+
+ org.apache.maven.doxia.tools.SiteTool
+ siteTool
+
+
+
+
+ report-only
+ Creates a nicely formatted Surefire Test Report in html format. This goal does not run the tests, it only builds the reports. This is a workaround for https://issues.apache.org/jira/browse/SUREFIRE-257 <https://issues.apache.org/jira/browse/SUREFIRE-257>
+ false
+ true
+ false
+ false
+ false
+ true
+ org.apache.maven.plugins.surefire.report.SurefireOnlyReport
+ java
+ per-lookup
+ once-per-session
+ 2.3
+ false
+
+
+ aggregate
+ boolean
+ false
+ true
+ Whether to build an aggregated report at the root, or build individual reports.
+
+
+ alwaysGenerateSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report will be generated even when there are no surefire result files. Defaults to true to preserve legacy behaviour pre 2.10.
+
+
+ customBundle
+ java.lang.String
+ 3.1.0
+ false
+ true
+ Path for a custom bundle instead of using the default one.
+Using this field, you could change the texts in the generated reports.
+
+
+ inputEncoding
+ java.lang.String
+ false
+ false
+
+
+
+ linkXRef
+ boolean
+ false
+ true
+ Link the violation line numbers to the (Test) Source XRef. Links will be created automatically if the JXR plugin is being used.
+
+
+ locale
+ java.lang.String
+ false
+ true
+
+
+
+ mojoExecution
+ org.apache.maven.plugin.MojoExecution
+ true
+ false
+
+
+
+ outputDirectory
+ java.io.File
+ true
+ true
+
+
+
+ outputEncoding
+ java.lang.String
+ false
+ false
+
+
+
+ outputFormat
+ java.lang.String
+ false
+ true
+
+
+
+ outputName
+ java.lang.String
+ true
+ true
+ The filename to use for the report.
+
+
+ outputTimestamp
+ java.lang.String
+ false
+ true
+
+
+
+ project
+ org.apache.maven.project.MavenProject
+ true
+ false
+
+
+
+ reactorProjects
+ java.util.List
+ true
+ false
+
+
+
+ remoteProjectRepositories
+ java.util.List
+ true
+ false
+
+
+
+ repoSession
+ org.eclipse.aether.RepositorySystemSession
+ true
+ false
+
+
+
+ reportsDirectories
+ java.io.File[]
+ false
+ true
+ Directories containing the XML Report files that will be parsed and rendered to HTML format.
+
+
+ reportsDirectory
+ java.io.File
+ No reason given
+ false
+ true
+ (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format.
+
+
+ settings
+ org.apache.maven.settings.Settings
+ true
+ false
+ The current user system settings for use in Maven.
+
+
+ showSuccess
+ boolean
+ true
+ true
+ If set to false, only failures are shown.
+
+
+ siteDirectory
+ java.io.File
+ false
+ true
+
+
+
+ skipSurefireReport
+ boolean
+ 2.11
+ false
+ true
+ If set to true the surefire report generation will be skipped.
+
+
+ xrefTestLocation
+ java.io.File
+ false
+ true
+ Location where Test Source XRef is generated for this project.
+Default: org.apache.maven.reporting.AbstractMavenReport.getReportOutputDirectory() + /xref-test
+
+
+
+ ${aggregate}
+ ${alwaysGenerateSurefireReport}
+
+ ${encoding}
+ ${linkXRef}
+
+
+
+ ${outputEncoding}
+ ${output.format}
+ ${outputName}
+
+
+
+
+
+
+ ${showSuccess}
+
+ ${skipSurefireReport}
+
+
+
+ org.codehaus.plexus.PlexusContainer
+ container
+
+
+ org.codehaus.plexus.i18n.I18N
+ i18n
+
+
+ org.apache.maven.doxia.siterenderer.Renderer
+ siteRenderer
+
+
+ org.apache.maven.doxia.tools.SiteTool
+ siteTool
+
+
+
+
+
+
+ org.apache.maven.surefire
+ surefire-logger-api
+ jar
+ 3.5.2
+
+
+ org.apache.maven.surefire
+ surefire-report-parser
+ jar
+ 3.5.2
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.plexus
+ jar
+ 0.9.0.M3
+
+
+ org.slf4j
+ slf4j-api
+ jar
+ 1.7.36
+
+
+ org.codehaus.plexus
+ plexus-classworlds
+ jar
+ 2.8.0
+
+
+ org.codehaus.plexus
+ plexus-component-annotations
+ jar
+ 2.1.0
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.inject
+ jar
+ 0.9.0.M3
+
+
+ org.codehaus.plexus
+ plexus-utils
+ jar
+ 4.0.1
+
+
+ javax.inject
+ javax.inject
+ jar
+ 1
+
+
+ org.codehaus.plexus
+ plexus-xml
+ jar
+ 3.0.1
+
+
+ org.apache.maven.shared
+ maven-shared-utils
+ jar
+ 3.3.4
+
+
+ commons-io
+ commons-io
+ jar
+ 2.17.0
+
+
+ org.apache.maven.doxia
+ doxia-sink-api
+ jar
+ 2.0.0
+
+
+ org.apache.maven.doxia
+ doxia-core
+ jar
+ 2.0.0
+
+
+ org.apache.commons
+ commons-lang3
+ jar
+ 3.17.0
+
+
+ org.apache.commons
+ commons-text
+ jar
+ 1.12.0
+
+
+ org.apache.maven.reporting
+ maven-reporting-impl
+ jar
+ 4.0.0
+
+
+ org.apache.maven.doxia
+ doxia-site-renderer
+ jar
+ 2.0.0
+
+
+ org.apache.maven.doxia
+ doxia-skin-model
+ jar
+ 2.0.0
+
+
+ org.apache.velocity
+ velocity-engine-core
+ jar
+ 2.4
+
+
+ org.codehaus.plexus
+ plexus-velocity
+ jar
+ 2.2.0
+
+
+ org.apache.maven.doxia
+ doxia-module-xhtml5
+ jar
+ 2.0.0
+
+
+ org.apache.maven.doxia
+ doxia-module-xdoc
+ jar
+ 2.0.0
+
+
+ org.apache.maven.doxia
+ doxia-integration-tools
+ jar
+ 2.0.0
+
+
+ org.apache.maven.reporting
+ maven-reporting-api
+ jar
+ 4.0.0
+
+
+ org.apache.maven
+ maven-archiver
+ jar
+ 3.6.2
+
+
+ org.codehaus.plexus
+ plexus-archiver
+ jar
+ 4.10.0
+
+
+ org.codehaus.plexus
+ plexus-io
+ jar
+ 3.5.0
+
+
+ org.tukaani
+ xz
+ jar
+ 1.9
+
+
+ org.apache.commons
+ commons-compress
+ jar
+ 1.27.1
+
+
+ commons-codec
+ commons-codec
+ jar
+ 1.16.1
+
+
+ org.apache.maven.doxia
+ doxia-site-model
+ jar
+ 2.0.0
+
+
+ org.apache.maven.doxia
+ doxia-module-apt
+ jar
+ 2.0.0
+
+
+ org.codehaus.plexus
+ plexus-i18n
+ jar
+ 1.0-beta-10
+
+
+ org.codehaus.plexus
+ plexus-interpolation
+ jar
+ 1.27
+
+
+
diff -urEbwBN a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_report_plugin/HelpMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_report_plugin/HelpMojo.java
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_report_plugin/HelpMojo.java 1970-01-01 01:00:00.000000000 +0100
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugin/maven_surefire_report_plugin/HelpMojo.java 2024-11-04 10:39:38.158690041 +0100
@@ -0,0 +1,448 @@
+package org.apache.maven.plugins.maven_surefire_report_plugin;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Display help information on maven-surefire-report-plugin.
+ * Call mvn surefire-report:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.
+ * @author maven-plugin-tools
+ */
+@Mojo( name = "help", requiresProject = false, threadSafe = true )
+public class HelpMojo
+ extends AbstractMojo
+{
+ /**
+ * If true
, display all settable properties for each goal.
+ *
+ */
+ @Parameter( property = "detail", defaultValue = "false" )
+ private boolean detail;
+
+ /**
+ * The name of the goal for which to show help. If unspecified, all goals will be displayed.
+ *
+ */
+ @Parameter( property = "goal" )
+ private java.lang.String goal;
+
+ /**
+ * The maximum length of a display line, should be positive.
+ *
+ */
+ @Parameter( property = "lineLength", defaultValue = "80" )
+ private int lineLength;
+
+ /**
+ * The number of spaces per indentation level, should be positive.
+ *
+ */
+ @Parameter( property = "indentSize", defaultValue = "2" )
+ private int indentSize;
+
+ // /META-INF/maven///plugin-help.xml
+ private static final String PLUGIN_HELP_PATH =
+ "/META-INF/maven/org.apache.maven.plugins/maven-surefire-report-plugin/plugin-help.xml";
+
+ private static final int DEFAULT_LINE_LENGTH = 80;
+
+ private Document build()
+ throws MojoExecutionException
+ {
+ getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH );
+ try ( InputStream is = getClass().getResourceAsStream( PLUGIN_HELP_PATH ) )
+ {
+ if ( is == null )
+ {
+ throw new MojoExecutionException( "Could not find plugin descriptor at " + PLUGIN_HELP_PATH );
+ }
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ return dBuilder.parse( is );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ catch ( ParserConfigurationException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ catch ( SAXException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( lineLength <= 0 )
+ {
+ getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
+ lineLength = DEFAULT_LINE_LENGTH;
+ }
+ if ( indentSize <= 0 )
+ {
+ getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
+ indentSize = 2;
+ }
+
+ Document doc = build();
+
+ StringBuilder sb = new StringBuilder();
+ Node plugin = getSingleChild( doc, "plugin" );
+
+
+ String name = getValue( plugin, "name" );
+ String version = getValue( plugin, "version" );
+ String id = getValue( plugin, "groupId" ) + ":" + getValue( plugin, "artifactId" ) + ":" + version;
+ if ( isNotEmpty( name ) && !name.contains( id ) )
+ {
+ append( sb, name + " " + version, 0 );
+ }
+ else
+ {
+ if ( isNotEmpty( name ) )
+ {
+ append( sb, name, 0 );
+ }
+ else
+ {
+ append( sb, id, 0 );
+ }
+ }
+ append( sb, getValue( plugin, "description" ), 1 );
+ append( sb, "", 0 );
+
+ //plugin
+ String goalPrefix = getValue( plugin, "goalPrefix" );
+
+ Node mojos1 = getSingleChild( plugin, "mojos" );
+
+ List mojos = findNamedChild( mojos1, "mojo" );
+
+ if ( goal == null || goal.length() <= 0 )
+ {
+ append( sb, "This plugin has " + mojos.size() + ( mojos.size() > 1 ? " goals:" : " goal:" ), 0 );
+ append( sb, "", 0 );
+ }
+
+ for ( Node mojo : mojos )
+ {
+ writeGoal( sb, goalPrefix, (Element) mojo );
+ }
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( sb.toString() );
+ }
+ }
+
+
+ private static boolean isNotEmpty( String string )
+ {
+ return string != null && string.length() > 0;
+ }
+
+ private static String getValue( Node node, String elementName )
+ throws MojoExecutionException
+ {
+ return getSingleChild( node, elementName ).getTextContent();
+ }
+
+ private static Node getSingleChild( Node node, String elementName )
+ throws MojoExecutionException
+ {
+ List namedChild = findNamedChild( node, elementName );
+ if ( namedChild.isEmpty() )
+ {
+ throw new MojoExecutionException( "Could not find " + elementName + " in plugin-help.xml" );
+ }
+ if ( namedChild.size() > 1 )
+ {
+ throw new MojoExecutionException( "Multiple " + elementName + " in plugin-help.xml" );
+ }
+ return namedChild.get( 0 );
+ }
+
+ private static List findNamedChild( Node node, String elementName )
+ {
+ List result = new ArrayList();
+ NodeList childNodes = node.getChildNodes();
+ for ( int i = 0; i < childNodes.getLength(); i++ )
+ {
+ Node item = childNodes.item( i );
+ if ( elementName.equals( item.getNodeName() ) )
+ {
+ result.add( item );
+ }
+ }
+ return result;
+ }
+
+ private static Node findSingleChild( Node node, String elementName )
+ throws MojoExecutionException
+ {
+ List elementsByTagName = findNamedChild( node, elementName );
+ if ( elementsByTagName.isEmpty() )
+ {
+ return null;
+ }
+ if ( elementsByTagName.size() > 1 )
+ {
+ throw new MojoExecutionException( "Multiple " + elementName + "in plugin-help.xml" );
+ }
+ return elementsByTagName.get( 0 );
+ }
+
+ private void writeGoal( StringBuilder sb, String goalPrefix, Element mojo )
+ throws MojoExecutionException
+ {
+ String mojoGoal = getValue( mojo, "goal" );
+ Node configurationElement = findSingleChild( mojo, "configuration" );
+ Node description = findSingleChild( mojo, "description" );
+ if ( goal == null || goal.length() <= 0 || mojoGoal.equals( goal ) )
+ {
+ append( sb, goalPrefix + ":" + mojoGoal, 0 );
+ Node deprecated = findSingleChild( mojo, "deprecated" );
+ if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) )
+ {
+ append( sb, "Deprecated. " + deprecated.getTextContent(), 1 );
+ if ( detail && description != null )
+ {
+ append( sb, "", 0 );
+ append( sb, description.getTextContent(), 1 );
+ }
+ }
+ else if ( description != null )
+ {
+ append( sb, description.getTextContent(), 1 );
+ }
+ append( sb, "", 0 );
+
+ if ( detail )
+ {
+ Node parametersNode = getSingleChild( mojo, "parameters" );
+ List parameters = findNamedChild( parametersNode, "parameter" );
+ append( sb, "Available parameters:", 1 );
+ append( sb, "", 0 );
+
+ for ( Node parameter : parameters )
+ {
+ writeParameter( sb, parameter, configurationElement );
+ }
+ }
+ }
+ }
+
+ private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement )
+ throws MojoExecutionException
+ {
+ String parameterName = getValue( parameter, "name" );
+ String parameterDescription = getValue( parameter, "description" );
+
+ Element fieldConfigurationElement = null;
+ if ( configurationElement != null )
+ {
+ fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName );
+ }
+
+ String parameterDefaultValue = "";
+ if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) )
+ {
+ parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")";
+ }
+ append( sb, parameterName + parameterDefaultValue, 2 );
+ Node deprecated = findSingleChild( parameter, "deprecated" );
+ if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) )
+ {
+ append( sb, "Deprecated. " + deprecated.getTextContent(), 3 );
+ append( sb, "", 0 );
+ }
+ if ( isNotEmpty( parameterDescription ) ) {
+ append( sb, parameterDescription, 3 );
+ }
+ if ( "true".equals( getValue( parameter, "required" ) ) )
+ {
+ append( sb, "Required: Yes", 3 );
+ }
+ if ( ( fieldConfigurationElement != null ) && isNotEmpty( fieldConfigurationElement.getTextContent() ) )
+ {
+ String property = getPropertyFromExpression( fieldConfigurationElement.getTextContent() );
+ append( sb, "User property: " + property, 3 );
+ }
+
+ append( sb, "", 0 );
+ }
+
+ /**
+ * Repeat a String n
times to form a new string.
+ *
+ * @param str String to repeat
+ * @param repeat number of times to repeat str
+ * @return String with repeated String
+ * @throws NegativeArraySizeException if repeat < 0
+ * @throws NullPointerException if str is null
+ */
+ private static String repeat( String str, int repeat )
+ {
+ StringBuilder buffer = new StringBuilder( repeat * str.length() );
+
+ for ( int i = 0; i < repeat; i++ )
+ {
+ buffer.append( str );
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ * Append a description to the buffer by respecting the indentSize and lineLength parameters.
+ * Note: The last character is always a new line.
+ *
+ * @param sb The buffer to append the description, not null
.
+ * @param description The description, not null
.
+ * @param indent The base indentation level of each line, must not be negative.
+ */
+ private void append( StringBuilder sb, String description, int indent )
+ {
+ for ( String line : toLines( description, indent, indentSize, lineLength ) )
+ {
+ sb.append( line ).append( '\n' );
+ }
+ }
+
+ /**
+ * Splits the specified text into lines of convenient display length.
+ *
+ * @param text The text to split into lines, must not be null
.
+ * @param indent The base indentation level of each line, must not be negative.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ * @return The sequence of display lines, never null
.
+ * @throws NegativeArraySizeException if indent < 0
+ */
+ private static List toLines( String text, int indent, int indentSize, int lineLength )
+ {
+ List lines = new ArrayList();
+
+ String ind = repeat( "\t", indent );
+
+ String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
+
+ for ( String plainLine : plainLines )
+ {
+ toLines( lines, ind + plainLine, indentSize, lineLength );
+ }
+
+ return lines;
+ }
+
+ /**
+ * Adds the specified line to the output sequence, performing line wrapping if necessary.
+ *
+ * @param lines The sequence of display lines, must not be null
.
+ * @param line The line to add, must not be null
.
+ * @param indentSize The size of each indentation, must not be negative.
+ * @param lineLength The length of the line, must not be negative.
+ */
+ private static void toLines( List lines, String line, int indentSize, int lineLength )
+ {
+ int lineIndent = getIndentLevel( line );
+ StringBuilder buf = new StringBuilder( 256 );
+
+ String[] tokens = line.split( " +" );
+
+ for ( String token : tokens )
+ {
+ if ( buf.length() > 0 )
+ {
+ if ( buf.length() + token.length() >= lineLength )
+ {
+ lines.add( buf.toString() );
+ buf.setLength( 0 );
+ buf.append( repeat( " ", lineIndent * indentSize ) );
+ }
+ else
+ {
+ buf.append( ' ' );
+ }
+ }
+
+ for ( int j = 0; j < token.length(); j++ )
+ {
+ char c = token.charAt( j );
+ if ( c == '\t' )
+ {
+ buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
+ }
+ else if ( c == '\u00A0' )
+ {
+ buf.append( ' ' );
+ }
+ else
+ {
+ buf.append( c );
+ }
+ }
+ }
+ lines.add( buf.toString() );
+ }
+
+ /**
+ * Gets the indentation level of the specified line.
+ *
+ * @param line The line whose indentation level should be retrieved, must not be null
.
+ * @return The indentation level of the line.
+ */
+ private static int getIndentLevel( String line )
+ {
+ int level = 0;
+ for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
+ {
+ level++;
+ }
+ for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
+ {
+ if ( line.charAt( i ) == '\t' )
+ {
+ level++;
+ break;
+ }
+ }
+ return level;
+ }
+
+ private static String getPropertyFromExpression( String expression )
+ {
+ if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" )
+ && !expression.substring( 2 ).contains( "${" ) )
+ {
+ // expression="${xxx}" -> property="xxx"
+ return expression.substring( 2, expression.length() - 1 );
+ }
+ // no property can be extracted
+ return null;
+ }
+}