This is an automated email from the ASF dual-hosted git repository.
claude pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
The following commit(s) were added to refs/heads/master by this push:
new cc55d24b Fix RAT-508: too much output on level INFO during maven runs
(#563)
cc55d24b is described below
commit cc55d24b01081d209c33107deb2829fcbe3f7dc6
Author: Claude Warren <[email protected]>
AuthorDate: Thu Dec 18 16:45:38 2025 +0100
Fix RAT-508: too much output on level INFO during maven runs (#563)
* moved some logging from info to debu
* Added verbose tag for Maven processing
* changed RAT-469-default test to run with debug
* RAT-508: Add explicit integration test with site generation and debug
output
---------
Co-authored-by: P. Ottlinger <[email protected]>
---
.../resources/ReportTest/RAT_246/commandLine.txt | 3 +-
.../it/resources/ReportTest/RAT_246/verify.groovy | 4 +-
.../java/org/apache/rat/ReportConfiguration.java | 12 ++++++
.../rat/config/exclusion/ExclusionProcessor.java | 34 +++++++++++++----
.../apache/rat/config/results/ClaimValidator.java | 2 +-
.../java/org/apache/rat/utils/ReportingSet.java | 7 +++-
apache-rat-plugin/pom.xml | 2 +-
.../src/it/RAT-469-default/invoker.properties | 2 +-
apache-rat-plugin/src/it/RAT-469-default/pom.xml | 1 +
.../src/it/RAT-469-default/verify.groovy | 5 ++-
apache-rat-plugin/src/it/RAT-469/pom.xml | 1 +
apache-rat-plugin/src/it/RAT-469/verify.groovy | 2 -
.../invoker.properties | 2 +-
.../src/it/{RAT-469-default => RAT-508}/pom.xml | 44 +++++++++++++---------
.../src/it/{RAT-469 => RAT-508}/verify.groovy | 11 +++---
.../java/org/apache/rat/mp/AbstractRatMojo.java | 14 +++++--
.../main/java/org/apache/rat/mp/RatCheckMojo.java | 37 ++++++++++++------
.../main/java/org/apache/rat/mp/RatReportMojo.java | 39 ++++++++++++-------
.../src/site/markdown/migrationguide/0.18.md | 4 +-
src/changes/changes.xml | 3 ++
20 files changed, 155 insertions(+), 74 deletions(-)
diff --git
a/apache-rat-core/src/it/resources/ReportTest/RAT_246/commandLine.txt
b/apache-rat-core/src/it/resources/ReportTest/RAT_246/commandLine.txt
index c70017bd..bdea3cd3 100644
--- a/apache-rat-core/src/it/resources/ReportTest/RAT_246/commandLine.txt
+++ b/apache-rat-core/src/it/resources/ReportTest/RAT_246/commandLine.txt
@@ -1,3 +1,4 @@
--input-exclude-parsed-scm
GIT
---
+--log-level
+DEBUG
diff --git a/apache-rat-core/src/it/resources/ReportTest/RAT_246/verify.groovy
b/apache-rat-core/src/it/resources/ReportTest/RAT_246/verify.groovy
index 1be9253b..03abff4a 100644
--- a/apache-rat-core/src/it/resources/ReportTest/RAT_246/verify.groovy
+++ b/apache-rat-core/src/it/resources/ReportTest/RAT_246/verify.groovy
@@ -25,5 +25,5 @@ assert content.contains('/dir1/FileToProcess')
logOutput = new File(args[1])
log = logOutput.text
-assert log.contains('INFO: Processing exclude file from GIT.')
-assert log.contains("INFO: Excluding GIT collection.")
\ No newline at end of file
+assert log.contains('DEBUG: Processing exclude file from GIT.')
+assert log.contains("DEBUG: Excluding GIT collection.")
\ No newline at end of file
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
b/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
index a927b7c0..aacd360b 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
@@ -175,6 +175,18 @@ public class ReportConfiguration {
reportables = new ArrayList<>();
}
+ /**
+ * Report the excluded files to the appendable object.
+ * @param appendable the appendable object to write to.
+ */
+ public void reportExclusions(final Appendable appendable) {
+ try {
+ exclusionProcessor.reportExclusions(appendable);
+ } catch (IOException e) {
+ DefaultLog.getInstance().warn("Unable to report exclusions", e);
+ }
+ }
+
/**
* Adds a file as a source of files to scan.
* The file must be a text file that lists files to be included.
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/config/exclusion/ExclusionProcessor.java
b/apache-rat-core/src/main/java/org/apache/rat/config/exclusion/ExclusionProcessor.java
index 7f908750..dc661b6f 100644
---
a/apache-rat-core/src/main/java/org/apache/rat/config/exclusion/ExclusionProcessor.java
+++
b/apache-rat-core/src/main/java/org/apache/rat/config/exclusion/ExclusionProcessor.java
@@ -18,6 +18,7 @@
*/
package org.apache.rat.config.exclusion;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -85,7 +86,7 @@ public class ExclusionProcessor {
* @return this
*/
public ExclusionProcessor addIncludedPatterns(final Iterable<String>
patterns) {
- DefaultLog.getInstance().info(format("Including patterns: %s",
String.join(", ", patterns)));
+ DefaultLog.getInstance().debug(format("Including patterns: %s",
String.join(", ", patterns)));
patterns.forEach(includedPatterns::add);
resetLastMatcher();
return this;
@@ -111,7 +112,7 @@ public class ExclusionProcessor {
*/
public ExclusionProcessor addFileProcessor(final StandardCollection
collection) {
if (collection != null) {
- DefaultLog.getInstance().info(format("Processing exclude file from
%s.", collection));
+ DefaultLog.getInstance().debug(format("Processing exclude file
from %s.", collection));
fileProcessors.add(collection);
resetLastMatcher();
}
@@ -125,7 +126,7 @@ public class ExclusionProcessor {
*/
public ExclusionProcessor addIncludedCollection(final StandardCollection
collection) {
if (collection != null) {
- DefaultLog.getInstance().info(format("Including %s collection.",
collection));
+ DefaultLog.getInstance().debug(format("Including %s collection.",
collection));
includedCollections.add(collection);
resetLastMatcher();
}
@@ -138,7 +139,7 @@ public class ExclusionProcessor {
* @return this
*/
public ExclusionProcessor addExcludedPatterns(final Iterable<String>
patterns) {
- DefaultLog.getInstance().info(format("Excluding patterns: %s",
String.join(", ", patterns)));
+ DefaultLog.getInstance().debug(format("Excluding patterns: %s",
String.join(", ", patterns)));
patterns.forEach(excludedPatterns::add);
resetLastMatcher();
return this;
@@ -157,6 +158,25 @@ public class ExclusionProcessor {
return this;
}
+ /**
+ * Report the excluded files to the appendable object.
+ * @param appendable the appendable object to write to.
+ */
+ public void reportExclusions(final Appendable appendable) throws
IOException {
+ appendable.append(format("Excluding patterns: %s%n", String.join(", ",
excludedPatterns)));
+ appendable.append(format("Including patterns: %s%n", String.join(", ",
includedPatterns)));
+ for (StandardCollection sc : excludedCollections) {
+ appendable.append(format("Excluding %s collection.%n", sc.name()));
+ }
+ for (StandardCollection sc : includedCollections) {
+ appendable.append(format("Including %s collection.%n", sc.name()));
+ }
+ for (StandardCollection sc : fileProcessors) {
+ appendable.append(format("Processing exclude file from %s.%n",
sc.name()));
+ }
+ }
+
+
/**
* Excludes the files/directories specified by a StandardCollection.
* @param collection the StandardCollection that identifies the files to
exclude.
@@ -164,7 +184,7 @@ public class ExclusionProcessor {
*/
public ExclusionProcessor addExcludedCollection(final StandardCollection
collection) {
if (collection != null) {
- DefaultLog.getInstance().info(format("Excluding %s collection.",
collection));
+ DefaultLog.getInstance().debug(format("Excluding %s collection.",
collection));
excludedCollections.add(collection);
resetLastMatcher();
}
@@ -302,13 +322,13 @@ public class ExclusionProcessor {
private void extractPaths(final MatcherSet.Builder matcherBuilder) {
if (!includedPaths.isEmpty()) {
for (DocumentNameMatcher matcher : includedPaths) {
- DefaultLog.getInstance().info(format("Including path matcher
%s", matcher));
+ DefaultLog.getInstance().debug(format("Including path matcher
%s", matcher));
matcherBuilder.addIncluded(matcher);
}
}
if (!excludedPaths.isEmpty()) {
for (DocumentNameMatcher matcher : excludedPaths) {
- DefaultLog.getInstance().info(format("Excluding path matcher
%s", matcher));
+ DefaultLog.getInstance().debug(format("Excluding path matcher
%s", matcher));
matcherBuilder.addExcluded(matcher);
}
}
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/config/results/ClaimValidator.java
b/apache-rat-core/src/main/java/org/apache/rat/config/results/ClaimValidator.java
index 25d659b0..f295f276 100644
---
a/apache-rat-core/src/main/java/org/apache/rat/config/results/ClaimValidator.java
+++
b/apache-rat-core/src/main/java/org/apache/rat/config/results/ClaimValidator.java
@@ -129,7 +129,7 @@ public final class ClaimValidator {
if (!isValid(counter, statistic.getCounter(counter))) {
DefaultLog.getInstance().error(format("Unexpected count for
%s, limit is [%s,%s]. Count: %s", counter,
min.get(counter), max.get(counter),
statistic.getCounter(counter)));
- DefaultLog.getInstance().info(format("%s (%s) is %s", counter,
counter.displayName(),
+ DefaultLog.getInstance().debug(format("%s (%s) is %s",
counter, counter.displayName(),
StringUtils.uncapitalize(counter.getDescription())));
}
}
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/utils/ReportingSet.java
b/apache-rat-core/src/main/java/org/apache/rat/utils/ReportingSet.java
index 1a05d109..d3c8ea8b 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/utils/ReportingSet.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/utils/ReportingSet.java
@@ -18,6 +18,7 @@
*/
package org.apache.rat.utils;
+import java.io.PrintWriter;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
@@ -28,6 +29,8 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
+import org.apache.rat.api.RatException;
+
/**
* A sorted set that reports insertion collisions.
* @param <T> the type of object
@@ -111,10 +114,12 @@ public class ReportingSet<T> implements SortedSet<T> {
*/
private boolean add(final boolean reportDup, final T e) {
if (delegate.contains(e)) {
- String msg = String.format("%s",
ReportingSet.this.duplicateFmt.apply(e));
+ String msg = ReportingSet.this.duplicateFmt.apply(e);
if (reportDup) {
msg = String.format("%s (action: %s)", msg, duplicateOption);
DefaultLog.getInstance().log(duplicateLogLevel, msg);
+ new RatException("just for trace").printStackTrace(new
PrintWriter(DefaultLog.getInstance().asWriter()));
+ DefaultLog.getInstance().warn(new RatException("just for
trace"));
}
switch (duplicateOption) {
case FAIL:
diff --git a/apache-rat-plugin/pom.xml b/apache-rat-plugin/pom.xml
index 88244c7c..883103ba 100644
--- a/apache-rat-plugin/pom.xml
+++ b/apache-rat-plugin/pom.xml
@@ -219,7 +219,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
- <cloneProjectsTo>${project.basedir}/invoker_target</cloneProjectsTo>
+
<cloneProjectsTo>${project.build.directory}/invoker_target</cloneProjectsTo>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<addTestClassPath>true</addTestClassPath>
<settingsFile>src/it/settings.xml</settingsFile>
diff --git a/apache-rat-plugin/src/it/RAT-469-default/invoker.properties
b/apache-rat-plugin/src/it/RAT-469-default/invoker.properties
index 6486eb1d..1c089b46 100644
--- a/apache-rat-plugin/src/it/RAT-469-default/invoker.properties
+++ b/apache-rat-plugin/src/it/RAT-469-default/invoker.properties
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-invoker.goals = clean apache-rat:rat
+invoker.goals = clean -X apache-rat:rat
diff --git a/apache-rat-plugin/src/it/RAT-469-default/pom.xml
b/apache-rat-plugin/src/it/RAT-469-default/pom.xml
index e4910f35..a962f9da 100644
--- a/apache-rat-plugin/src/it/RAT-469-default/pom.xml
+++ b/apache-rat-plugin/src/it/RAT-469-default/pom.xml
@@ -28,6 +28,7 @@
<artifactId>apache-rat-plugin</artifactId>
<version>@pom.version@</version>
<configuration>
+ <verbose>true</verbose>
<consoleOutput>true</consoleOutput>
<ignoreErrors>false</ignoreErrors>
<inputIncludes>
diff --git a/apache-rat-plugin/src/it/RAT-469-default/verify.groovy
b/apache-rat-plugin/src/it/RAT-469-default/verify.groovy
index d8abff9f..7e5a1dcc 100644
--- a/apache-rat-plugin/src/it/RAT-469-default/verify.groovy
+++ b/apache-rat-plugin/src/it/RAT-469-default/verify.groovy
@@ -19,8 +19,9 @@ import org.apache.rat.testhelpers.TextUtils
content = new File(basedir, 'build.log').text
assert content.contains('BUILD SUCCESS')
-assert content.contains('[INFO] Including patterns: pom.xml') // explicit
inclusion worked
-assert content.contains('[INFO] Processing exclude file from STANDARD_SCMS.')
// default exclusions worked
+// should be DEBUG because we are running with a -X option.
+assert content.contains('[DEBUG] Including patterns: pom.xml') // explicit
inclusion worked
+assert content.contains('[DEBUG] Processing exclude file from STANDARD_SCMS.')
// default exclusions worked
assert ! content.contains('[WARNING] No resources included')
// Report is in apache-rat-plugin/target/invoker-reports
diff --git a/apache-rat-plugin/src/it/RAT-469/pom.xml
b/apache-rat-plugin/src/it/RAT-469/pom.xml
index aa894676..10ea7967 100644
--- a/apache-rat-plugin/src/it/RAT-469/pom.xml
+++ b/apache-rat-plugin/src/it/RAT-469/pom.xml
@@ -28,6 +28,7 @@
<artifactId>apache-rat-plugin</artifactId>
<version>@pom.version@</version>
<configuration>
+ <verbose>true</verbose>
<licensesApproved>GPL3</licensesApproved>
<consoleOutput>true</consoleOutput>
<ignoreErrors>false</ignoreErrors>
diff --git a/apache-rat-plugin/src/it/RAT-469/verify.groovy
b/apache-rat-plugin/src/it/RAT-469/verify.groovy
index b3a7320f..c5b5c0ee 100644
--- a/apache-rat-plugin/src/it/RAT-469/verify.groovy
+++ b/apache-rat-plugin/src/it/RAT-469/verify.groovy
@@ -19,8 +19,6 @@ import org.apache.rat.testhelpers.TextUtils
content = new File(basedir, 'build.log').text
assert content.contains('BUILD SUCCESS')
-assert content.contains('[INFO] Including patterns: pom.xml') // explicit
inclusion worked
-assert content.contains('[INFO] Processing exclude file from STANDARD_SCMS.')
// default exclusions worked
assert ! content.contains('[WARNING] No resources included')
// Report is in apache-rat-plugin/target/invoker-reports
diff --git a/apache-rat-plugin/src/it/RAT-469-default/invoker.properties
b/apache-rat-plugin/src/it/RAT-508/invoker.properties
similarity index 95%
copy from apache-rat-plugin/src/it/RAT-469-default/invoker.properties
copy to apache-rat-plugin/src/it/RAT-508/invoker.properties
index 6486eb1d..1c089b46 100644
--- a/apache-rat-plugin/src/it/RAT-469-default/invoker.properties
+++ b/apache-rat-plugin/src/it/RAT-508/invoker.properties
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-invoker.goals = clean apache-rat:rat
+invoker.goals = clean -X apache-rat:rat
diff --git a/apache-rat-plugin/src/it/RAT-469-default/pom.xml
b/apache-rat-plugin/src/it/RAT-508/pom.xml
similarity index 51%
copy from apache-rat-plugin/src/it/RAT-469-default/pom.xml
copy to apache-rat-plugin/src/it/RAT-508/pom.xml
index e4910f35..6a66121c 100644
--- a/apache-rat-plugin/src/it/RAT-469-default/pom.xml
+++ b/apache-rat-plugin/src/it/RAT-508/pom.xml
@@ -1,25 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- RAT-469 integration test
+ RAT-508 integration test
Copyright (C) 2025, ASF Apache Creadur
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ 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
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ 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.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.rat.test</groupId>
- <artifactId>it-rat469-default</artifactId>
+ <artifactId>it-rat508</artifactId>
<version>1.0</version>
<build>
<plugins>
@@ -28,16 +31,14 @@
<artifactId>apache-rat-plugin</artifactId>
<version>@pom.version@</version>
<configuration>
+ <verbose>true</verbose>
<consoleOutput>true</consoleOutput>
<ignoreErrors>false</ignoreErrors>
<inputIncludes>
<include>pom.xml</include>
</inputIncludes>
<inputExcludeStds>
- <exclude>STANDARD_PATTERNS</exclude>
- <exclude>STANDARD_SCMS</exclude>
- <exclude>MAVEN</exclude>
- <exclude>IDEA</exclude>
+ <exclude>ALL</exclude>
</inputExcludeStds>
</configuration>
</plugin>
@@ -48,9 +49,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
- <version>3.3.2</version>
+ <version>3.5.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>@pom.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
diff --git a/apache-rat-plugin/src/it/RAT-469/verify.groovy
b/apache-rat-plugin/src/it/RAT-508/verify.groovy
similarity index 82%
copy from apache-rat-plugin/src/it/RAT-469/verify.groovy
copy to apache-rat-plugin/src/it/RAT-508/verify.groovy
index b3a7320f..3e801af3 100644
--- a/apache-rat-plugin/src/it/RAT-469/verify.groovy
+++ b/apache-rat-plugin/src/it/RAT-508/verify.groovy
@@ -18,20 +18,21 @@ import org.apache.rat.testhelpers.TextUtils
content = new File(basedir, 'build.log').text
+// verify debug output
+assert content.contains('input-exclude-std ALL')
+assert content.contains('Adding [MAVEN] to input-exclude-std')
+assert content.contains('Including patterns: pom.xml')
+
assert content.contains('BUILD SUCCESS')
-assert content.contains('[INFO] Including patterns: pom.xml') // explicit
inclusion worked
-assert content.contains('[INFO] Processing exclude file from STANDARD_SCMS.')
// default exclusions worked
assert ! content.contains('[WARNING] No resources included')
// Report is in apache-rat-plugin/target/invoker-reports
+// Make sure that report is generated completely
report = new File(basedir, 'target/site/rat-report.html').text
assert TextUtils.isMatching("^ /verify.groovy\\s+S ", report)
assert TextUtils.isMatching("^ /pom.xml\\s+S ", report)
assert report.contains('Unapproved: 0')
-assert report.contains('GPL : 1')
-assert report.contains(' GPL GPL3 GNU General Public License
V3.0')
-
assert report.contains('AL AL2.0 Apache License 2.0')
assert report.contains('Approved: 3')
assert report.contains('Standards: 3')
diff --git
a/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
b/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
index 0ecbe939..6624022e 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java
@@ -72,6 +72,13 @@ public abstract class AbstractRatMojo extends BaseRatMojo {
@Parameter(property = "rat.basedir", defaultValue = "${basedir}", required
= true)
private File basedir;
+ /**
+ * Specifies the verbose output.
+ * @since 0.8
+ */
+ @Parameter(property = "rat.verbose", defaultValue = "false")
+ protected boolean verbose;
+
/**
* Specifies the licenses to accept. By default, these are added to the
default
* licenses, unless you set <addDefaultLicenseMatchers> to false.
Arguments should be
@@ -266,7 +273,7 @@ public abstract class AbstractRatMojo extends BaseRatMojo {
}
protected Defaults.Builder getDefaultsBuilder() {
- Defaults.Builder result = Defaults.builder();
+ Defaults.Builder result = Defaults.builder().noDefault();
if (defaultLicenseFiles != null) {
for (String defaultLicenseFile : defaultLicenseFiles) {
result.add(defaultLicenseFile);
@@ -462,7 +469,7 @@ public abstract class AbstractRatMojo extends BaseRatMojo {
Log log = DefaultLog.getInstance();
if (reportConfiguration == null) {
try {
- if (super.getLog().isDebugEnabled()) {
+ if (getLog().isDebugEnabled()) {
log.debug("Start BaseRatMojo Configuration options");
for (Map.Entry<String, List<String>> entry :
args.entrySet()) {
log.debug(format(" * %s %s", entry.getKey(),
String.join(", ", entry.getValue())));
@@ -472,10 +479,9 @@ public abstract class AbstractRatMojo extends BaseRatMojo {
boolean helpLicenses = !getValues(Arg.HELP_LICENSES).isEmpty();
removeKey(Arg.HELP_LICENSES);
-
setIncludeExclude();
- getLog().warn("Basedir is : " + basedir);
+ getLog().debug("Basedir is : " + basedir);
ReportConfiguration config =
OptionCollection.parseCommands(basedir, args().toArray(new String[0]),
o -> getLog().warn("Help option not supported"),
true);
diff --git
a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
index 13ea48b2..6fabeb60 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
@@ -21,6 +21,7 @@ package org.apache.rat.mp;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
+import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -36,6 +37,7 @@ import org.apache.rat.commandline.StyleSheets;
import org.apache.rat.license.LicenseSetFactory.LicenseFilter;
import org.apache.rat.report.claim.ClaimStatistic;
import org.apache.rat.utils.DefaultLog;
+import org.apache.rat.utils.Log;
import static java.lang.String.format;
@@ -179,24 +181,33 @@ public class RatCheckMojo extends AbstractRatMojo {
setArg(Arg.OUTPUT_FILE.option().getLongOpt(),
defaultReportFile.getAbsolutePath());
}
- ReportConfiguration config = getConfiguration();
-
- logLicenses(config.getLicenses(LicenseFilter.ALL));
- try {
- this.reporter = new Reporter(config);
- reporter.output();
- check(config);
- } catch (MojoFailureException e) {
- throw e;
- } catch (Exception e) {
- throw new MojoExecutionException(e.getMessage(), e);
+ try (Writer logWriter = DefaultLog.getInstance().asWriter()) {
+ ReportConfiguration config = getConfiguration();
+ logLicenses(config.getLicenses(LicenseFilter.ALL));
+ if (verbose) {
+ config.reportExclusions(logWriter);
+ }
+ try {
+ this.reporter = new Reporter(config);
+ reporter.output();
+ if (verbose) {
+ reporter.writeSummary(logWriter);
+ }
+ check(config);
+ } catch (MojoFailureException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ } catch (IOException e) {
+ DefaultLog.getInstance().warn("Unable to close writable log.", e);
}
}
protected void check(final ReportConfiguration config) throws
MojoFailureException {
ClaimStatistic statistics = reporter.getClaimsStatistic();
try {
- reporter.writeSummary(DefaultLog.getInstance().asWriter());
+
reporter.writeSummary(DefaultLog.getInstance().asWriter(Log.Level.DEBUG));
if (config.getClaimValidator().hasErrors()) {
config.getClaimValidator().logIssues(statistics);
if (consoleOutput &&
@@ -219,6 +230,8 @@ public class RatCheckMojo extends AbstractRatMojo {
} else {
getLog().info(msg);
}
+ } else {
+ DefaultLog.getInstance().info("No issues found.");
}
} catch (IOException e) {
throw new MojoFailureException(e);
diff --git
a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
index 900d78f2..330d3c5e 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
@@ -54,7 +54,9 @@ import org.apache.maven.reporting.MavenReportException;
import org.apache.rat.ReportConfiguration;
import org.apache.rat.Reporter;
import org.apache.rat.VersionInfo;
+import org.apache.rat.api.RatException;
import org.apache.rat.license.LicenseSetFactory.LicenseFilter;
+import org.apache.rat.utils.DefaultLog;
import org.codehaus.plexus.util.ReaderFactory;
import org.eclipse.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.RemoteRepository;
@@ -88,6 +90,7 @@ public class RatReportMojo extends AbstractRatMojo implements
MavenMultiPageRepo
@Parameter(property = "outputEncoding", defaultValue =
"${project.reporting.outputEncoding}", readonly = true)
private String outputEncoding;
+
/**
* The local repository.
*/
@@ -428,25 +431,33 @@ public class RatReportMojo extends AbstractRatMojo
implements MavenMultiPageRepo
sink.link(bundle.getString("report.rat.url"));
sink.text(bundle.getString("report.rat.fullName"));
sink.link_();
- final String ratVersion = new
VersionInfo(RatReportMojo.class).toString();
- if (ratVersion != null) {
- sink.text(" " + ratVersion);
- }
+ sink.text(" " + new VersionInfo(RatReportMojo.class));
sink.text(".");
sink.paragraph_();
sink.paragraph();
sink.verbatim(new SinkEventAttributeSet());
- try {
- ReportConfiguration config = getConfiguration();
- config.setFrom(getDefaultsBuilder().build());
- logLicenses(config.getLicenses(LicenseFilter.ALL));
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- config.setOut(() -> baos);
- new Reporter(config).output();
- sink.text(baos.toString(StandardCharsets.UTF_8.name()));
- } catch (Exception e) {
- throw new MavenReportException(e.getMessage(), e);
+ try (Writer logWriter = DefaultLog.getInstance().asWriter()) {
+ try {
+ ReportConfiguration config = getConfiguration();
+ config.setFrom(getDefaultsBuilder().build());
+ logLicenses(config.getLicenses(LicenseFilter.ALL));
+ if (verbose) {
+ config.reportExclusions(logWriter);
+ }
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ config.setOut(() -> baos);
+ Reporter reporter = new Reporter(config);
+ reporter.output();
+ if (verbose) {
+ reporter.writeSummary(logWriter);
+ }
+ sink.text(baos.toString(StandardCharsets.UTF_8.name()));
+ } catch (IOException | MojoExecutionException | RatException e) {
+ throw new MavenReportException(e.getMessage(), e);
+ }
+ } catch (IOException e) {
+ DefaultLog.getInstance().warn("Unable to close log writer", e);
}
sink.verbatim_();
sink.paragraph_();
diff --git a/apache-rat/src/site/markdown/migrationguide/0.18.md
b/apache-rat/src/site/markdown/migrationguide/0.18.md
index 7ca7093e..3705e3e6 100644
--- a/apache-rat/src/site/markdown/migrationguide/0.18.md
+++ b/apache-rat/src/site/markdown/migrationguide/0.18.md
@@ -21,8 +21,6 @@ Release 0.18 is an intermediate release as we are working on
big architectural c
## Maven
-tbd
-
-* tbd - replace option ```<foo>``` by ```<bar>```
+* [RAT-508](https://issues.apache.org/jira/browse/RAT-508) reduced the logging
output of exclusion parsers and the exclusion engine. If you want to see these
messages run with ```-X``` or use the ```<verbose>true</verbose>``` option in
your pom.xml or ```-Drat.verbose=true``` on the command line.
[<<< back to migration guide overview](../migration_guide.html)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 301933e6..2eb18169 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -68,6 +68,9 @@ in order to be properly linked in site reports.
</release>
-->
<release version="1.0.0" date="xxxx-yy-zz" description="Current SNAPSHOT -
release to be done">
+ <action issue="RAT-508" type="update" dev="claudenw" due-to="Gary D.
Gregory">
+ Removed excess INFO logging in Maven plugin. Run with -X or use the
verbose option in order to see output on debug level.
+ </action>
<action issue="RAT-498" type="update" dev="pottlinger">
Update Maven wrapper to v3.9.12.
</action>