This is an automated email from the ASF dual-hosted git repository. claude pushed a commit to branch RAT-524_Fix_DocumentName.isCaseSensitive_detection_time in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
commit 55e7dfb7ac06df2ba93eaf372507ce870da34f1d Author: Claude Warren <[email protected]> AuthorDate: Thu Dec 18 17:16:29 2025 +0000 added skipping of MAVEN files when running under Maven --- .../src/it/RAT-524/invoker.properties | 16 ++++++ apache-rat-plugin/src/it/RAT-524/pom.xml | 63 ++++++++++++++++++++++ apache-rat-plugin/src/it/RAT-524/verify.groovy | 32 +++++++++++ .../java/org/apache/rat/mp/AbstractRatMojo.java | 2 +- .../main/java/org/apache/rat/mp/RatCheckMojo.java | 20 +++++++ .../src/templates/apt/mvn_options.apt.vm | 4 ++ 6 files changed, 136 insertions(+), 1 deletion(-) diff --git a/apache-rat-plugin/src/it/RAT-524/invoker.properties b/apache-rat-plugin/src/it/RAT-524/invoker.properties new file mode 100644 index 00000000..6486eb1d --- /dev/null +++ b/apache-rat-plugin/src/it/RAT-524/invoker.properties @@ -0,0 +1,16 @@ +# 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. + +invoker.goals = clean apache-rat:rat diff --git a/apache-rat-plugin/src/it/RAT-524/pom.xml b/apache-rat-plugin/src/it/RAT-524/pom.xml new file mode 100644 index 00000000..01c6a71d --- /dev/null +++ b/apache-rat-plugin/src/it/RAT-524/pom.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + RAT-508 integration test + Copyright (C) 2025, ASF Apache Creadur + + 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. + +--> +<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-rat508</artifactId> + <version>1.0</version> + <build> + <plugins> + <plugin> + <groupId>org.apache.rat</groupId> + <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> + </configuration> + </plugin> + </plugins> + <!-- RAT-354: prevent warning about missing version property of maven-clean-plugin --> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <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-524/verify.groovy b/apache-rat-plugin/src/it/RAT-524/verify.groovy new file mode 100644 index 00000000..47a9a8b6 --- /dev/null +++ b/apache-rat-plugin/src/it/RAT-524/verify.groovy @@ -0,0 +1,32 @@ +/* + * 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. + */ +import org.apache.rat.testhelpers.TextUtils + +content = new File(basedir, 'build.log').text + +// verify debug output +assert content.contains('BUILD SUCCESS') +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 TextUtils.isMatching("^ /target\\s+I\\s+application/octet-stream\\s+\\(directory\\)", report) + +assert report.contains('Unapproved: 0') 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 6624022e..ab2129c9 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 @@ -70,7 +70,7 @@ public abstract class AbstractRatMojo extends BaseRatMojo { * The base directory, in which to search for files. */ @Parameter(property = "rat.basedir", defaultValue = "${basedir}", required = true) - private File basedir; + protected File basedir; /** * Specifies the verbose output. 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 6fabeb60..63b98aa5 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 @@ -20,6 +20,7 @@ package org.apache.rat.mp; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileFilter; import java.io.IOException; import java.io.Writer; import java.nio.charset.StandardCharsets; @@ -34,6 +35,7 @@ import org.apache.rat.ReportConfiguration; import org.apache.rat.Reporter; import org.apache.rat.commandline.Arg; import org.apache.rat.commandline.StyleSheets; +import org.apache.rat.config.exclusion.StandardCollection; import org.apache.rat.license.LicenseSetFactory.LicenseFilter; import org.apache.rat.report.claim.ClaimStatistic; import org.apache.rat.utils.DefaultLog; @@ -57,6 +59,12 @@ public class RatCheckMojo extends AbstractRatMojo { @Parameter(defaultValue = "${project.build.directory}/rat.txt") private File defaultReportFile; + /** + * The defined build directory + */ + @Parameter(defaultValue = "${project.build.directory}", readonly = true) + private String buildDirectory; + /** * Where to store the report. * @deprecated Use 'out' property instead. @@ -159,6 +167,18 @@ public class RatCheckMojo extends AbstractRatMojo { if (numUnapprovedLicenses > 0) { result.getClaimValidator().setMax(ClaimStatistic.Counter.UNAPPROVED, numUnapprovedLicenses); } + result.addExcludedCollection(StandardCollection.MAVEN); + if (StandardCollection.MAVEN.fileProcessorBuilder().hasNext()) { + result.addExcludedFileProcessor(StandardCollection.MAVEN); + } + if (StandardCollection.MAVEN.hasStaticDocumentNameMatcher()) { + StandardCollection.MAVEN.staticDocumentNameMatcher(); + } + + String buildDirAbsolutePath = new File(buildDirectory).getAbsolutePath(); + FileFilter buildFilter = f -> f.getAbsolutePath().startsWith(buildDirAbsolutePath); + result.addExcludedFilter(buildFilter); + return result; } diff --git a/apache-rat-plugin/src/templates/apt/mvn_options.apt.vm b/apache-rat-plugin/src/templates/apt/mvn_options.apt.vm index 4a22a214..a127eb2c 100644 --- a/apache-rat-plugin/src/templates/apt/mvn_options.apt.vm +++ b/apache-rat-plugin/src/templates/apt/mvn_options.apt.vm @@ -26,6 +26,10 @@ Maven Options The RAT Maven plugin has many of the same options as the command line as well as a few that are specific to the Maven environment. The argument types specified in the list below are defined in the section following. + By default the RAT Maven plugin excludes the MAVEN standard collection as well as the defined project build directory. + If there there is a need to include any of these the MAVEN standard collection can be added to + \<inputIncludeStd\> and the project build directory can be added to \<inputInclude\> using the standard expression syntax. + * The Options #set($descEnd = ${rat.doubleLine} + " ")
