You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by cl...@apache.org on 2026/10/14 14:19:47 UTC

(creadur-rat) 02/02: initial move of Maven UI

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

Claudenw pushed a commit to branch Maven-UI
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git

commit 9a59036d5d44eaed9b0402c0f6509533ca82308c
Author: Claude Warren <cl...@xenei.com>
AuthorDate: Sat Oct 10 09:52:54 2026 +0100

    initial move of Maven UI
---
 .../java/org/apache/rat/maven/AbstractMaven.java   | 636 +++++++++++++++++++++
 .../java/org/apache/rat/maven/MavenTestDynIT.java  | 257 +++++++++
 .../apache/rat/maven/RecordingOutputHandler.java   |  48 ++
 3 files changed, 941 insertions(+)

diff --git a/apache-rat-maven-parent/plugin/src/main/java/org/apache/rat/maven/AbstractMaven.java b/apache-rat-maven-parent/plugin/src/main/java/org/apache/rat/maven/AbstractMaven.java
new file mode 100644
index 000000000..2517bde62
--- /dev/null
+++ b/apache-rat-maven-parent/plugin/src/main/java/org/apache/rat/maven/AbstractMaven.java
@@ -0,0 +1,636 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rat.maven;
+
+import java.util.Optional;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.rat.commandline.Arg;
+import org.apache.rat.config.exclusion.StandardCollection;
+import org.apache.rat.ui.ArgumentTracker;
+
+/**
+ * Generated class to provide Maven support for standard RAT command line options
+ * DO NOT EDIT - GENERATED FILE
+ */
+@SuppressWarnings("checkstyle:LineLength")
+public abstract class AbstractMaven extends AbstractMojo {
+    /** The arguments that have been set */
+    protected final ArgumentTracker argumentTracker;
+    /** The MavenOptionCollection */
+    protected final MavenOptionCollection mavenOptionCollection;
+
+    protected AbstractMaven() {
+        mavenOptionCollection = new MavenOptionCollection();
+        argumentTracker = new ArgumentTracker(mavenOptionCollection);
+        Optional<MavenOption> mavenOption = mavenOptionCollection.getMappedOption(Arg.EXCLUDE_STD.option());
+        argumentTracker.addArg(mavenOption.orElseThrow(() -> new IllegalStateException(Arg.EXCLUDE_STD.option() + " not found in Maven option collection")), StandardCollection.MAVEN.name());
+    }
+
+    /*  GENERATED METHODS */
+
+
+    /**
+     * Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list.
+     * @param addLicense The state
+     * @deprecated Deprecated for removal since 0.17: Use <editLicense> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.addLicense")
+    public void setAddLicense(final boolean addLicense) {
+        if (addLicense) {
+            argumentTracker.setArg("addLicense", null);
+        } else {
+            argumentTracker.removeArg("addLicense");
+        }
+    }
+
+
+
+    /**
+     * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
+     * @param configs names for system configuration.
+     */
+    @Parameter
+    public void setConfigs(final String[] configs) {
+        argumentTracker.addArg("config", configs);
+    }
+
+
+
+    /**
+     * Ignore default configuration.
+     * @param configurationNoDefaults The state
+     */
+    @Parameter(property = "rat.configurationNoDefaults")
+    public void setConfigurationNoDefaults(final boolean configurationNoDefaults) {
+        if (configurationNoDefaults) {
+            argumentTracker.setArg("configuration-no-defaults", null);
+        } else {
+            argumentTracker.removeArg("configuration-no-defaults");
+        }
+    }
+
+
+
+    /**
+     * The copyright message to use in the license headers. Argument should be a Arg. (See Argument Types for clarification)
+     * @param copyright copyright message to use in the license headers.
+     * @deprecated Deprecated for removal since 0.17: Use <editCopyright> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.copyright")
+    public void setCopyright(final String copyright) {
+        argumentTracker.setArg("copyright", copyright);
+    }
+
+
+
+    /**
+     * The acceptable maximum number for the specified counter. A value of '-1' specifies an unlimited number. Arguments should be CounterPattern. (See Argument Types for clarification)
+     * @param counterMaxs acceptable maximum number for the specified counter.
+     */
+    @Parameter
+    public void setCounterMaxs(final String[] counterMaxs) {
+        argumentTracker.addArg("counter-max", counterMaxs);
+    }
+
+
+
+    /**
+     * The minimum number for the specified counter. Arguments should be CounterPattern. (See Argument Types for clarification)
+     * @param counterMins minimum number for the specified counter.
+     */
+    @Parameter
+    public void setCounterMins(final String[] counterMins) {
+        argumentTracker.addArg("counter-min", counterMins);
+    }
+
+
+
+    /**
+     * If set do not update the files but generate the reports.
+     * @param dryRun The state
+     */
+    @Parameter(property = "rat.dryRun")
+    public void setDryRun(final boolean dryRun) {
+        if (dryRun) {
+            argumentTracker.setArg("dry-run", null);
+        } else {
+            argumentTracker.removeArg("dry-run");
+        }
+    }
+
+
+
+    /**
+     * The copyright message to use in the license headers. Usually in the form of "Copyright 2008 Foo".  Only valid with <editLicense> Argument should be a Arg. (See Argument Types for clarification)
+     * @param editCopyright copyright message to use in the license headers.
+     */
+    @Parameter(property = "rat.editCopyright")
+    public void setEditCopyright(final String editCopyright) {
+        argumentTracker.setArg("edit-copyright", editCopyright);
+    }
+
+
+
+    /**
+     * Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list. By default new files will be created with the license header, to force the modification of existing files use the <editOverwrite> option.
+     * @param editLicense The state
+     */
+    @Parameter(property = "rat.editLicense")
+    public void setEditLicense(final boolean editLicense) {
+        if (editLicense) {
+            argumentTracker.setArg("edit-license", null);
+        } else {
+            argumentTracker.removeArg("edit-license");
+        }
+    }
+
+
+
+    /**
+     * Forces any changes in files to be written directly to the source files so that new files are not created. Only valid with <editLicense>.
+     * @param editOverwrite The state
+     */
+    @Parameter(property = "rat.editOverwrite")
+    public void setEditOverwrite(final boolean editOverwrite) {
+        if (editOverwrite) {
+            argumentTracker.setArg("edit-overwrite", null);
+        } else {
+            argumentTracker.removeArg("edit-overwrite");
+        }
+    }
+
+
+
+    /**
+     * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
+     * @param excludeFile <Expression> entries from a file.
+     * @deprecated Deprecated for removal since 0.17: Use <inputExcludeFile> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.excludeFile")
+    public void setExcludeFile(final String excludeFile) {
+        argumentTracker.setArg("exclude-file", excludeFile);
+    }
+
+
+
+    /**
+     * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
+     * @param excludes files matching <Expression>.
+     * @deprecated Deprecated for removal since 0.17: Use <inputExcludes> instead.
+     */
+    @Deprecated
+    @Parameter
+    public void setExcludes(final String[] excludes) {
+        argumentTracker.addArg("exclude", excludes);
+    }
+
+
+
+    /**
+     * Forces any changes in files to be written directly to the source files so that new files are not created.
+     * @param force The state
+     * @deprecated Deprecated for removal since 0.17: Use <editOverwrite> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.force")
+    public void setForce(final boolean force) {
+        if (force) {
+            argumentTracker.setArg("force", null);
+        } else {
+            argumentTracker.removeArg("force");
+        }
+    }
+
+
+
+    /**
+     * Print information about registered licenses.
+     * @param helpLicenses The state
+     */
+    @Parameter(property = "rat.helpLicenses")
+    public void setHelpLicenses(final boolean helpLicenses) {
+        if (helpLicenses) {
+            argumentTracker.setArg("help-licenses", null);
+        } else {
+            argumentTracker.removeArg("help-licenses");
+        }
+    }
+
+
+
+    /**
+     * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
+     * @param includes files matching <Expression>.
+     * @deprecated Deprecated for removal since 0.17: Use <inputIncludes> instead.
+     */
+    @Deprecated
+    @Parameter
+    public void setIncludes(final String[] includes) {
+        argumentTracker.addArg("include", includes);
+    }
+
+
+
+    /**
+     * Reads <Expression> entries from a file. Entries will override excluded files. Argument should be a File. (See Argument Types for clarification)
+     * @param includesFile <Expression> entries from a file.
+     * @deprecated Deprecated for removal since 0.17: Use <inputIncludeFile> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.includesFile")
+    public void setIncludesFile(final String includesFile) {
+        argumentTracker.setArg("includes-file", includesFile);
+    }
+
+
+
+    /**
+     * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
+     * @param inputExcludeFile <Expression> entries from a file.
+     */
+    @Parameter(property = "rat.inputExcludeFile")
+    public void setInputExcludeFile(final String inputExcludeFile) {
+        argumentTracker.setArg("input-exclude-file", inputExcludeFile);
+    }
+
+
+
+    /**
+     * Parse SCM based exclusion files to exclude specified files and directories. This action can apply to any standard collection that implements a file processor. Arguments should be StandardCollection. (See Argument Types for clarification)
+     * @param inputExcludeParsedScms SCM based exclusion files to exclude specified files and directories.
+     */
+    @Parameter
+    public void setInputExcludeParsedScms(final String[] inputExcludeParsedScms) {
+        argumentTracker.addArg("input-exclude-parsed-scm", inputExcludeParsedScms);
+    }
+
+
+
+    /**
+     * Excludes files with sizes less than the number of bytes specified. Argument should be a Integer. (See Argument Types for clarification)
+     * @param inputExcludeSize files with sizes less than the number of bytes specified.
+     */
+    @Parameter(property = "rat.inputExcludeSize")
+    public void setInputExcludeSize(final String inputExcludeSize) {
+        argumentTracker.setArg("input-exclude-size", inputExcludeSize);
+    }
+
+
+
+    /**
+     * Excludes files defined in standard collections based on commonly occurring groups. Excludes any path matcher actions but DOES NOT exclude any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
+     * @param inputExcludeStds files defined in standard collections based on commonly occurring groups.
+     */
+    @Parameter
+    public void setInputExcludeStds(final String[] inputExcludeStds) {
+        argumentTracker.addArg("input-exclude-std", inputExcludeStds);
+    }
+
+
+
+    /**
+     * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
+     * @param inputExcludes files matching <Expression>.
+     */
+    @Parameter
+    public void setInputExcludes(final String[] inputExcludes) {
+        argumentTracker.addArg("input-exclude", inputExcludes);
+    }
+
+
+
+    /**
+     * Reads <Expression> entries from a file. Entries will override excluded files. Argument should be a File. (See Argument Types for clarification)
+     * @param inputIncludeFile <Expression> entries from a file.
+     */
+    @Parameter(property = "rat.inputIncludeFile")
+    public void setInputIncludeFile(final String inputIncludeFile) {
+        argumentTracker.setArg("input-include-file", inputIncludeFile);
+    }
+
+
+
+    /**
+     * Includes files defined in standard collections based on commonly occurring groups. Includes any path matcher actions but DOES NOT include any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
+     * @param inputIncludeStds files defined in standard collections based on commonly occurring groups.
+     */
+    @Parameter
+    public void setInputIncludeStds(final String[] inputIncludeStds) {
+        argumentTracker.addArg("input-include-std", inputIncludeStds);
+    }
+
+
+
+    /**
+     * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
+     * @param inputIncludes files matching <Expression>.
+     */
+    @Parameter
+    public void setInputIncludes(final String[] inputIncludes) {
+        argumentTracker.addArg("input-include", inputIncludes);
+    }
+
+
+
+    /**
+     * A file containing file names to process. File names must use linux directory separator ('/') or none at all. File names that do not start with '/' are relative to the directory where the argument is located. Arguments should be File. (See Argument Types for clarification)
+     * @param inputSources file containing file names to process.
+     */
+    @Parameter
+    public void setInputSources(final String[] inputSources) {
+        argumentTracker.addArg("input-source", inputSources);
+    }
+
+
+
+    /**
+     * A comma separated list of approved license family IDs. These license families will be added to the list of approved license families. Argument should be a FamilyID. (See Argument Types for clarification)
+     * @param licenseFamiliesApproved comma separated list of approved license family IDs.
+     */
+    @Parameter(property = "rat.licenseFamiliesApproved")
+    public void setLicenseFamiliesApproved(final String licenseFamiliesApproved) {
+        argumentTracker.setArg("license-families-approved", licenseFamiliesApproved);
+    }
+
+
+
+    /**
+     * Name of file containing comma separated lists of approved family IDs. Argument should be a File. (See Argument Types for clarification)
+     * @param licenseFamiliesApprovedFile of file containing comma separated lists of approved family IDs.
+     */
+    @Parameter(property = "rat.licenseFamiliesApprovedFile")
+    public void setLicenseFamiliesApprovedFile(final String licenseFamiliesApprovedFile) {
+        argumentTracker.setArg("license-families-approved-file", licenseFamiliesApprovedFile);
+    }
+
+
+
+    /**
+     * A comma separated list of denied License family IDs. These license families will be removed from the list of approved licenses. Once license families are removed they can not be added back. Argument should be a FamilyID. (See Argument Types for clarification)
+     * @param licenseFamiliesDenied comma separated list of denied License family IDs.
+     */
+    @Parameter(property = "rat.licenseFamiliesDenied")
+    public void setLicenseFamiliesDenied(final String licenseFamiliesDenied) {
+        argumentTracker.setArg("license-families-denied", licenseFamiliesDenied);
+    }
+
+
+
+    /**
+     * Name of file containing comma separated lists of denied license IDs. These license families will be removed from the list of approved licenses. Once license families are removed they can not be added back. Argument should be a File. (See Argument Types for clarification)
+     * @param licenseFamiliesDeniedFile of file containing comma separated lists of denied license IDs.
+     */
+    @Parameter(property = "rat.licenseFamiliesDeniedFile")
+    public void setLicenseFamiliesDeniedFile(final String licenseFamiliesDeniedFile) {
+        argumentTracker.setArg("license-families-denied-file", licenseFamiliesDeniedFile);
+    }
+
+
+
+    /**
+     * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
+     * @param licenses names for system configuration.
+     * @deprecated Deprecated for removal since 0.17: Use <configs> instead.
+     */
+    @Deprecated
+    @Parameter
+    public void setLicenses(final String[] licenses) {
+        argumentTracker.addArg("licenses", licenses);
+    }
+
+
+
+    /**
+     * A comma separated list of approved License IDs. These licenses will be added to the list of approved licenses. Argument should be a LicenseID. (See Argument Types for clarification)
+     * @param licensesApproved comma separated list of approved License IDs.
+     */
+    @Parameter(property = "rat.licensesApproved")
+    public void setLicensesApproved(final String licensesApproved) {
+        argumentTracker.setArg("licenses-approved", licensesApproved);
+    }
+
+
+
+    /**
+     * Name of file containing comma separated lists of approved License IDs. Argument should be a File. (See Argument Types for clarification)
+     * @param licensesApprovedFile of file containing comma separated lists of approved License IDs.
+     */
+    @Parameter(property = "rat.licensesApprovedFile")
+    public void setLicensesApprovedFile(final String licensesApprovedFile) {
+        argumentTracker.setArg("licenses-approved-file", licensesApprovedFile);
+    }
+
+
+
+    /**
+     * A comma separated list of denied License IDs. These licenses will be removed from the list of approved licenses. Once licenses are removed they can not be added back. Argument should be a LicenseID. (See Argument Types for clarification)
+     * @param licensesDenied comma separated list of denied License IDs.
+     */
+    @Parameter(property = "rat.licensesDenied")
+    public void setLicensesDenied(final String licensesDenied) {
+        argumentTracker.setArg("licenses-denied", licensesDenied);
+    }
+
+
+
+    /**
+     * Name of file containing comma separated lists of the denied license IDs. These licenses will be removed from the list of approved licenses. Once licenses are removed they can not be added back. Argument should be a File. (See Argument Types for clarification)
+     * @param licensesDeniedFile of file containing comma separated lists of the denied license IDs.
+     */
+    @Parameter(property = "rat.licensesDeniedFile")
+    public void setLicensesDeniedFile(final String licensesDeniedFile) {
+        argumentTracker.setArg("licenses-denied-file", licensesDeniedFile);
+    }
+
+
+
+    /**
+     * List the defined license families. Argument should be a LicenseFilter. (See Argument Types for clarification)
+     * @param listFamilies the defined license families.
+     * @deprecated Deprecated for removal since 0.17: Use <outputFamilies> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.listFamilies")
+    public void setListFamilies(final String listFamilies) {
+        argumentTracker.setArg("list-families", listFamilies);
+    }
+
+
+
+    /**
+     * List the defined licenses. Argument should be a LicenseFilter. (See Argument Types for clarification)
+     * @param listLicenses the defined licenses.
+     * @deprecated Deprecated for removal since 0.17: Use <outputLicenses> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.listLicenses")
+    public void setListLicenses(final String listLicenses) {
+        argumentTracker.setArg("list-licenses", listLicenses);
+    }
+
+
+
+    /**
+     * Ignore default configuration.
+     * @param noDefaultLicenses The state
+     * @deprecated Deprecated for removal since 0.17: Use <configurationNoDefaults> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.noDefaultLicenses")
+    public void setNoDefaultLicenses(final boolean noDefaultLicenses) {
+        if (noDefaultLicenses) {
+            argumentTracker.setArg("no-default-licenses", null);
+        } else {
+            argumentTracker.removeArg("no-default-licenses");
+        }
+    }
+
+
+
+    /**
+     * Define the output file where to write a report to. Argument should be a File. (See Argument Types for clarification)
+     * @param out the output file where to write a report to.
+     * @deprecated Deprecated for removal since 0.17: Use <outputFile> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.out")
+    public void setOut(final String out) {
+        argumentTracker.setArg("out", out);
+    }
+
+
+
+    /**
+     * Specifies the level of detail in ARCHIVE file reporting. Argument should be a ProcessingType. (See Argument Types for clarification)
+     * @param outputArchive the level of detail in ARCHIVE file reporting.
+     */
+    @Parameter(property = "rat.outputArchive", defaultValue = "NOTIFICATION")
+    public void setOutputArchive(final String outputArchive) {
+        argumentTracker.setArg("output-archive", outputArchive);
+    }
+
+
+
+    /**
+     * List the defined license families. Argument should be a LicenseFilter. (See Argument Types for clarification)
+     * @param outputFamilies the defined license families.
+     */
+    @Parameter(property = "rat.outputFamilies", defaultValue = "NONE")
+    public void setOutputFamilies(final String outputFamilies) {
+        argumentTracker.setArg("output-families", outputFamilies);
+    }
+
+
+
+    /**
+     * Define the output file where to write a report to. Argument should be a File. (See Argument Types for clarification)
+     * @param outputFile the output file where to write a report to.
+     */
+    @Parameter(property = "rat.outputFile")
+    public void setOutputFile(final String outputFile) {
+        argumentTracker.setArg("output-file", outputFile);
+    }
+
+
+
+    /**
+     * List the defined licenses. Argument should be a LicenseFilter. (See Argument Types for clarification)
+     * @param outputLicenses the defined licenses.
+     */
+    @Parameter(property = "rat.outputLicenses", defaultValue = "NONE")
+    public void setOutputLicenses(final String outputLicenses) {
+        argumentTracker.setArg("output-licenses", outputLicenses);
+    }
+
+
+
+    /**
+     * Specifies the level of detail in STANDARD file reporting. Argument should be a ProcessingType. (See Argument Types for clarification)
+     * @param outputStandard the level of detail in STANDARD file reporting.
+     */
+    @Parameter(property = "rat.outputStandard", defaultValue = "ABSENCE")
+    public void setOutputStandard(final String outputStandard) {
+        argumentTracker.setArg("output-standard", outputStandard);
+    }
+
+
+
+    /**
+     * XSLT stylesheet to use when creating the report. Either an external xsl file may be specified or one of the internal named sheets. Argument should be a StyleSheet. (See Argument Types for clarification)
+     * @param outputStyle stylesheet to use when creating the report.
+     */
+    @Parameter(property = "rat.outputStyle")
+    public void setOutputStyle(final String outputStyle) {
+        argumentTracker.setArg("output-style", outputStyle);
+    }
+
+
+
+    /**
+     * Scans hidden directories.
+     * @param scanHiddenDirectories The state
+     * @deprecated Deprecated for removal since 0.17: Use <inputIncludeStds> with 'HIDDEN_DIR' argument instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.scanHiddenDirectories")
+    public void setScanHiddenDirectories(final boolean scanHiddenDirectories) {
+        if (scanHiddenDirectories) {
+            argumentTracker.setArg("scan-hidden-directories", null);
+        } else {
+            argumentTracker.removeArg("scan-hidden-directories");
+        }
+    }
+
+
+
+    /**
+     * XSLT stylesheet to use when creating the report. Argument should be a StyleSheet. (See Argument Types for clarification)
+     * @param stylesheet stylesheet to use when creating the report.
+     * @deprecated Deprecated for removal since 0.17: Use <outputStyle> instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.stylesheet")
+    public void setStylesheet(final String stylesheet) {
+        argumentTracker.setArg("stylesheet", stylesheet);
+    }
+
+
+
+    /**
+     * forces XML output rather than the textual report.
+     * @param xml The state
+     * @deprecated Deprecated for removal since 0.17: Use <outputStyle> with the 'xml' argument instead.
+     */
+    @Deprecated
+    @Parameter(property = "rat.xml")
+    public void setXml(final boolean xml) {
+        if (xml) {
+            argumentTracker.setArg("xml", null);
+        } else {
+            argumentTracker.removeArg("xml");
+        }
+    }
+
+}
diff --git a/apache-rat-maven-parent/plugin/src/test/java/org/apache/rat/maven/MavenTestDynIT.java b/apache-rat-maven-parent/plugin/src/test/java/org/apache/rat/maven/MavenTestDynIT.java
new file mode 100644
index 000000000..737f179f5
--- /dev/null
+++ b/apache-rat-maven-parent/plugin/src/test/java/org/apache/rat/maven/MavenTestDynIT.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rat.maven;
+
+import org.apache.maven.shared.invoker.DefaultInvocationRequest;
+import org.apache.maven.shared.invoker.DefaultInvoker;
+import org.apache.maven.shared.invoker.InvocationOutputHandler;
+import org.apache.maven.shared.invoker.InvocationRequest;
+import org.apache.maven.shared.invoker.InvocationResult;
+import org.apache.maven.shared.invoker.Invoker;
+import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.apache.rat.Reporter;
+import org.apache.rat.api.RatException;
+import org.apache.rat.commandline.StyleSheets;
+import org.apache.rat.document.DocumentName;
+import org.apache.rat.maven.MavenOptionCollection;
+import org.apache.rat.maven.RecordingOutputHandler;
+import org.apache.rat.maven.tools.TestGenerator;
+import org.apache.rat.report.claim.ClaimStatistic;
+import org.apache.rat.testhelpers.data.ReportTestDataProvider;
+import org.apache.rat.testhelpers.data.TestData;
+import org.apache.rat.testhelpers.data.ValidatorData;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Executes the dynamic tests provided by the ReportTestDataProvider.
+ */
+public class MavenTestDynIT {
+
+    private final TestGenerator testGenerator;
+    private final Map<String, Consumer<ValidatorData>> validatorEditors;
+
+    /**
+     * Constructor.
+     * @throws IOException on IO Exception,
+     */
+    public MavenTestDynIT() throws IOException {
+        testGenerator = new TestGenerator();
+        validatorEditors = new HashMap<>();
+        populateValidatorEditors();
+    }
+
+    /**
+     * Maven testing adds
+     * <ul>
+     *     <li>a pom.xml with Apache 2 license to the root directory</li>
+     *     <li>a .rat directory in the root directory</li>
+     *     <li>one or more files in the .rat directory.</li>
+     *     <li>a target directory</li>
+     *     <li>a rat.txt file to the target directory</li>
+     *     <li>a RAT directory to the target directory</li>
+     *     <li>3 xml files in the RAT directory.</li>
+     * </ul>
+     * These have to be accounted for in the counters.
+     */
+    private void populateValidatorEditors() {
+        /* In the changes below there are overcounts verses the expected
+        counts for commandline.  The changes are to decrements the counted
+        files so that they match what is expected for the command line.
+        The comment before each block of changes describes why they are changed.
+         */
+
+        // Decrements standards and approved by 1
+        Consumer<ValidatorData> stdApproved = data -> {
+            data.getStatistic().incCounter(ClaimStatistic.Counter.STANDARDS, -1);
+            data.getStatistic().incCounter(ClaimStatistic.Counter.APPROVED, -1);
+        };
+
+        // Decrements standards and ignored by 1
+        Consumer<ValidatorData> stdIgnored = data -> {
+            data.getStatistic().incCounter(ClaimStatistic.Counter.STANDARDS, -1);
+            data.getStatistic().incCounter(ClaimStatistic.Counter.IGNORED, -1);
+        };
+
+        /* POM is a standard file not found in the non-Maven test case
+         so we have to modify the STANDARD count in these cases to
+         account for it.  The POM also contains the tag for ONE so
+         there is an APPROVED is also modified.
+         */
+        validatorEditors.put("config/noDefaults", stdApproved);
+        validatorEditors.put("config/withDefaults", data -> {
+            data.getStatistic().incCounter(ClaimStatistic.Counter.STANDARDS, -1);
+            // with defaults POM has 2 approved licenses
+            data.getStatistic().incCounter(ClaimStatistic.Counter.APPROVED, -2);
+        });
+        validatorEditors.put("config_DefaultTest", stdApproved);
+
+        validatorEditors.put("exclude", stdIgnored);
+        validatorEditors.put("exclude-file", stdIgnored);
+        validatorEditors.put("excludeFile_DefaultTest", stdIgnored);
+        validatorEditors.put("exclude_DefaultTest", stdIgnored);
+        validatorEditors.put("include", stdIgnored);
+        validatorEditors.put("include_DefaultTest", stdIgnored);
+        validatorEditors.put("includes-file", stdIgnored);
+        validatorEditors.put("includesFile_DefaultTest", stdIgnored);
+        validatorEditors.put("input-exclude", stdIgnored);
+        validatorEditors.put("input-exclude-file", stdIgnored);
+        validatorEditors.put("input-exclude-parsed-scm/GIT", stdIgnored);
+        validatorEditors.put("input-exclude-size", stdIgnored);
+        validatorEditors.put("input-exclude-std", stdIgnored);
+        validatorEditors.put("input-exclude/include", stdIgnored);
+        validatorEditors.put("input-exclude/includeStdValidation", stdIgnored);
+        validatorEditors.put("input-exclude/includesFile", stdIgnored);
+        validatorEditors.put("input-exclude/inputInclude", stdIgnored);
+        validatorEditors.put("input-exclude/inputIncludeFile", stdIgnored);
+        validatorEditors.put("input-include", stdIgnored);
+        validatorEditors.put("input-include-file", stdIgnored);
+        validatorEditors.put("input-include-std/hidden_dir", stdIgnored);
+        validatorEditors.put("input-include-std/hidden_file", stdIgnored);
+        validatorEditors.put("input-include-std/misc", stdIgnored);
+        validatorEditors.put("inputExcludeFile_DefaultTest", stdIgnored);
+        validatorEditors.put("inputExcludeParsedScm_DefaultTest", stdIgnored);
+        validatorEditors.put("inputExcludeSize_DefaultTest", stdIgnored);
+        // maven automatically ignores target and build.log
+        validatorEditors.put("inputExcludeStd_DefaultTest", data -> {
+            data.getStatistic().incCounter(ClaimStatistic.Counter.IGNORED, -2);
+        });
+        validatorEditors.put("inputExclude_DefaultTest", stdIgnored);
+        validatorEditors.put("inputInclude_DefaultTest", stdIgnored);
+        validatorEditors.put("inputIncludeFile_DefaultTest", stdIgnored);
+        validatorEditors.put("inputSource_DefaultTest", stdIgnored);
+
+        validatorEditors.put("license-families-approved-file/withLicenseDef", stdApproved);
+        validatorEditors.put("license-families-approved-file/withoutLicenseDef", stdApproved);
+        validatorEditors.put("license-families-approved/withLicenseDef", stdApproved);
+        validatorEditors.put("license-families-approved/withoutLicenseDef", stdApproved);
+
+        validatorEditors.put("license-families-denied", stdApproved);
+        validatorEditors.put("license-families-denied-file", stdApproved);
+        validatorEditors.put("licenseFamiliesApprovedFile_DefaultTest", stdApproved);
+        validatorEditors.put("licenseFamiliesApproved_DefaultTest", stdApproved);
+        validatorEditors.put("licenseFamiliesDeniedFile_DefaultTest", stdApproved);
+        validatorEditors.put("licenseFamiliesDenied_DefaultTest", stdApproved);
+
+        validatorEditors.put("licenses-approved-file/withLicenseDef", stdApproved);
+        validatorEditors.put("licenses-approved-file/withoutLicenseDef", stdApproved);
+        validatorEditors.put("licenses-approved/withLicenseDef", stdApproved);
+        validatorEditors.put("licenses-approved/withoutLicenseDef", stdApproved);
+
+        validatorEditors.put("licenses/noDefaults", stdApproved);
+        validatorEditors.put("licenses/withDefaults", data -> {
+                    data.getStatistic().incCounter(ClaimStatistic.Counter.STANDARDS, -1);
+                    // with defaults POM has 2 approved licenses
+                    data.getStatistic().incCounter(ClaimStatistic.Counter.APPROVED, -2);
+                });
+        validatorEditors.put("licensesApprovedFile_DefaultTest", stdApproved);
+        validatorEditors.put("licensesApproved_DefaultTest", stdApproved);
+        validatorEditors.put("licenses_DefaultTest", stdApproved);
+
+        validatorEditors.put("out", stdApproved);
+        validatorEditors.put("output-file", stdApproved);
+
+
+        validatorEditors.put("scan-hidden-directories", stdIgnored);
+
+
+    }
+
+    /**
+     * Runs the test for the specified TestData.
+     * @param testData the test to run.
+     * @param testPath the path to create file etc. in .
+     * @throws IOException on IO Error.
+     * @throws MavenInvocationException on Maven invocation error.
+     * @throws RatException on RAT error.
+     */
+    @ParameterizedTest
+    @MethodSource("testData")
+    void optionTest(TestData testData, @TempDir Path testPath) throws IOException, MavenInvocationException, RatException {
+
+        Path baseDir = testPath.resolve(testData.getTestName());
+        String pomText = testGenerator.buildPom(testData);
+        System.out.println(pomText);
+        testData.setupFiles(baseDir);
+        File pomFile = baseDir.resolve("pom.xml").toFile();
+        try (FileOutputStream fos = new FileOutputStream(pomFile)) {
+            fos.write(pomText.getBytes(StandardCharsets.UTF_8));
+        }
+        RecordingOutputHandler[] recordingOutputHandler = {null};
+
+        InvocationRequest request = new DefaultInvocationRequest() {
+            @Override
+            public InvocationOutputHandler getOutputHandler(InvocationOutputHandler defaultHandler) {
+                recordingOutputHandler[0] = new RecordingOutputHandler(defaultHandler);
+                return super.getOutputHandler(recordingOutputHandler[0]);
+            }
+        };
+        request.setDebug(true);
+        request.setBatchMode(true);
+        request.setBaseDirectory(baseDir.toFile());
+        request.setPomFile(pomFile);
+        request.addArg("apache-rat:check");
+
+        Invoker invoker = new DefaultInvoker();
+        InvocationResult result = invoker.execute(request);
+        if (testData.expectingException()) {
+            assertThat(result.getExitCode()).as("Result of Maven execution").isEqualTo(1);
+            List<String> entries = recordingOutputHandler[0].getLines().filter(s -> s.contains(testData.getExpectedException().getMessage()))
+                    .filter(s -> s.contains("[ERROR]")).toList();
+            assertThat(entries).hasSize(1);
+        } else {
+            DocumentName baseName = DocumentName.builder(baseDir.toFile()).build();
+            Reporter.Output output = Reporter.Output.builder()
+                    .configuration("target/RAT/configuration.xml", baseName)
+                    .document("target/RAT/rat.xml", baseName)
+                    .statistic("target/RAT/claimStatistic.xml", baseName)
+                    .build();
+
+            ValidatorData validatorData = new ValidatorData(output, baseDir.toString());
+            Consumer<ValidatorData> editor = validatorEditors.get(testData.toString());
+            if (editor != null) {
+                editor.accept(validatorData);
+            }
+            output.format(StyleSheets.PLAIN.getStyleSheet().ioSupplier(), output.getConfiguration().getOutput() );
+            testData.getValidator().accept(validatorData);
+        }
+    }
+
+    /**
+     * The static class to create retrieve the tests for the MavenOptions.
+     * @return the collection of Tests for the supported options.
+     */
+    static Collection<TestData> testData() {
+        return new ReportTestDataProvider().getOptionTests(new MavenOptionCollection());
+    }
+}
diff --git a/apache-rat-maven-parent/plugin/src/test/java/org/apache/rat/maven/RecordingOutputHandler.java b/apache-rat-maven-parent/plugin/src/test/java/org/apache/rat/maven/RecordingOutputHandler.java
new file mode 100644
index 000000000..0d1291294
--- /dev/null
+++ b/apache-rat-maven-parent/plugin/src/test/java/org/apache/rat/maven/RecordingOutputHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rat.maven;
+
+import org.apache.maven.shared.invoker.InvocationOutputHandler;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+/**
+ * An output handler that records the output lines so they can be checked after the test run.
+ */
+public class RecordingOutputHandler implements InvocationOutputHandler {
+    private final InvocationOutputHandler delegate;
+    private final List<String> lines = new ArrayList<>();
+
+    RecordingOutputHandler(final InvocationOutputHandler delegate) {
+        this.delegate = delegate;
+    }
+
+    @Override
+    public void consumeLine(String line) throws IOException {
+        lines.add(line);
+        delegate.consumeLine(line);
+    }
+
+    public Stream<String> getLines() {
+        return lines.stream();
+    }
+}