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

stariy95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new 5fd712cd8 Fix RAT checks in maven and standalone
5fd712cd8 is described below

commit 5fd712cd8ae0cfa390d50cb3bec8964494a4e2e4
Author: ntimofeev <[email protected]>
AuthorDate: Thu Aug 20 22:40:22 2026 +0300

    Fix RAT checks in maven and standalone
---
 CLAUDE.md                                          | 17 +++++
 build-tools/rat-excludes                           | 45 ++++++++-----
 .../cayenne/project/upgrade/v12/project1.graph.xml | 16 +++++
 pom.xml                                            | 74 +++++++++++-----------
 rat.sh                                             | 36 +++++------
 5 files changed, 114 insertions(+), 74 deletions(-)

diff --git a/CLAUDE.md b/CLAUDE.md
index a2013a18f..1cdb4a669 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -20,6 +20,23 @@ mvn clean verify -DskipTests
 mvn clean verify -pl cayenne -am
 ```
 
+## License Headers
+
+Every source file needs an ASF license header. Apache Rat enforces this:
+
+```bash
+# Scans the whole source tree in a single pass from the root module. Skipped 
in every other
+# module, so a recursive run costs nothing extra.
+mvn apache-rat:check
+```
+
+The report lands in `target/rat.txt`. Exclusions live in 
`build-tools/rat-excludes` — the single
+canonical list, also mirrored in regex form in `rat.sh` (the standalone-jar 
fallback).
+
+Rat classifies generated files, binaries, archives, README-style notice files 
and anything matched
+by `.gitignore` on its own, so those need no exclusion entry. Prefer adding a 
header over adding an
+exclusion.
+
 ## Testing
 
 Tests split into two suites driven by different plugins, and **selecting a 
single test uses a different property for each**:
diff --git a/build-tools/rat-excludes b/build-tools/rat-excludes
index a3edd898b..5e5bd3e0e 100644
--- a/build-tools/rat-excludes
+++ b/build-tools/rat-excludes
@@ -13,26 +13,37 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
-#
-# Used by buildbot, but not by Maven or rat.sh
-#
-# For now manually keeping in sync with 'rat.sh'
 #
+# The canonical Rat exclusion list: read by the "apache-rat-plugin" 
configuration in the root
+# "pom.xml" via <inputExcludeFile. "rat.sh" keeps its own copy of the same
+# list in regex form, as the standalone Rat jar can't read this file - keep 
the two in sync.
+
+# hidden files and directories: .github, .claude, .asf.yaml, .gitignore, ...
+**/.*
+**/.*/**
 
-**/.classpath
-**/.project
-**/.gitignore
+# markdown is documentation, no license header by project convention
+**/*.md
+
+# generated or structural files with no place for a header
 **/_*.java
-**/*.plist
-**/index.eomodeld
-**/*.fspec
-**/DiagramLayout
-**/excludes.txt
-**/*.map.xml
 **/cayenne-*.xml
 **/cayenne.xml
+**/*.map.xml
 **/*.driver.xml
-**/*.html
-**/*.css
-**/derby.log
+**/*.plist
+**/*.eomodeld
+**/*.fspec
+**/DiagramLayout
+**/META-INF/services/*
+
+# a template of a NOTICE file, included into the build artifacts
+**/NOTICE.txt.vm
+
+# opaque test fixture (crypto plaintext input), Rat can not classify it as 
binary
+**/transformer/bytes/plain
+
+# ASF and distribution text that carries no header by convention
+KEYS
+RELEASE-NOTES.txt
+modeler/cayenne-modeler-mac/src/main/resources/README.txt
diff --git 
a/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/v12/project1.graph.xml
 
b/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/v12/project1.graph.xml
index 447447a36..e2ff84a23 100644
--- 
a/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/v12/project1.graph.xml
+++ 
b/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/v12/project1.graph.xml
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+-->
 <graphs xmlns="http://cayenne.apache.org/schema/11/graph";>
        <graph type="ER" scale="1.0">
                <entity name="db_entity" x="36.0" y="178.5" width="75.0" 
height="50.0"/>
diff --git a/pom.xml b/pom.xml
index 7fe0efb50..bf8da33c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -806,16 +806,6 @@
                     <groupId>org.apache.rat</groupId>
                     <artifactId>apache-rat-plugin</artifactId>
                     <version>${apache-rat-plugin.version}</version>
-                    <configuration>
-                        <licenses>
-                            <license 
implementation="org.apache.rat.analysis.license.ApacheSoftwareLicense20">
-                                <notes>Also allow the license url to be 
https.</notes>
-                                <patterns>
-                                    
<pattern>https://www.apache.org/licenses/LICENSE-2.0</pattern>
-                                </patterns>
-                            </license>
-                        </licenses>
-                    </configuration>
                 </plugin>
                 <plugin>
                     <groupId>org.objectstyle.japp</groupId>
@@ -926,33 +916,9 @@
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
                 <configuration>
-                    <excludes>
-                        <exclude>build/**/*</exclude>
-                        <exclude>**/.*</exclude>
-                        <exclude>**/.*/**</exclude>
-
-                        <exclude>**/cayenne-*.xml</exclude>
-                        <exclude>**/cayenne.xml</exclude>
-                        <exclude>**/*.map.xml</exclude>
-                        <exclude>**/_*.java</exclude>
-                        <exclude>**/*.html</exclude>
-                        <exclude>**/*.css</exclude>
-                        <exclude>**/*.driver.xml</exclude>
-
-                        <exclude>**/test/**/ks1.jceks</exclude>
-                        <exclude>**/test/**/plain.txt</exclude>
-
-                        <exclude>**/DiagramLayout</exclude>
-                        <exclude>**/*.plist</exclude>
-                        <exclude>**/*.eomodeld</exclude>
-                        <exclude>**/*.fspec</exclude>
-
-                        <exclude>**/*.log</exclude>
-                        <exclude>**/*.iml</exclude>
-
-                        <!-- This is a template of a NOTICE file, that will be 
included to the build artifacts -->
-                        <exclude>**/NOTICE.txt.vm</exclude>
-                    </excludes>
+                    <!-- Rat scans the whole tree from the root in one pass, 
so it is skipped
+                         everywhere except the root module - see the "rat" 
profile below. -->
+                    <skip>true</skip>
                 </configuration>
             </plugin>
             <plugin>
@@ -983,6 +949,40 @@
     </distributionManagement>
 
     <profiles>
+        <!--
+            License header check: "mvn apache-rat:check".
+
+            Activated only in the root module, as Rat scans the entire source 
tree in a single pass
+            (see "excludeSubProjects" below) and running it per-module would 
just repeat that scan.
+            "build-tools/rat-excludes" is resolved against the module basedir, 
so only the root
+            matches.
+        -->
+        <profile>
+            <id>rat</id>
+            <activation>
+                <file>
+                    <exists>build-tools/rat-excludes</exists>
+                </file>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.rat</groupId>
+                        <artifactId>apache-rat-plugin</artifactId>
+                        <configuration>
+                            <skip>false</skip>
+                            <!-- "basedir" must be pinned to the root: Rat 
resolves
+                                 "inputExcludeFile" against it, and mangles 
absolute paths on
+                                 Windows, so the exclusion list can only be 
given as a path
+                                 relative to the scan root. -->
+                            
<basedir>${maven.multiModuleProjectDirectory}</basedir>
+                            <excludeSubProjects>false</excludeSubProjects>
+                            
<inputExcludeFile>build-tools/rat-excludes</inputExcludeFile>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
         <!-- Optional profile used to sign artifacts -->
         <profile>
             <id>gpg</id>
diff --git a/rat.sh b/rat.sh
index 93209d0be..0498bf739 100755
--- a/rat.sh
+++ b/rat.sh
@@ -16,7 +16,8 @@
 # limitations under the License.
 
 #
-# Runs Rat checks on the source code. Prints report to STDOUT.
+# Fallback Rat check, for when a standalone Rat jar is preferred over Maven. 
The primary check is
+# "mvn apache-rat:check". Runs Rat checks on the source code, prints report to 
STDOUT.
 #
 # Usage:
 #    
@@ -47,28 +48,23 @@ echo "Deleting 'build' dirs..." 1>&2
 
 echo "Running rat, this may take a while..." 1>&2
 
-# TODO: read excludes from buildbot config at 'build-tools/rat-excludes'
+# Keep this in sync with 'build-tools/rat-excludes'.
 java -jar $RAT -d $DIR \
-       -e '\.classpath' \
-       -e '\.project' \
-       -e '\.gitignore' \
+       -e '\..+' \
        -e '\_.+\.java' \
+       -e '.+\.md' \
+       -e 'cayenne-.+\.xml' \
+       -e 'cayenne\.xml' \
+       -e '.+\.map\.xml' \
+       -e '.+\.driver\.xml' \
        -e '.+\.plist' \
-       -e 'index\.eomodeld' \
+       -e '.+\.eomodeld' \
        -e '.+\.fspec' \
        -e 'DiagramLayout' \
-       -e 'excludes\.txt' \
-       -e '.+\.map\.xml' \
-       -e 'cayenne-*.xml' \
-       -e 'cayenne\.xml' \
-       -e '.+\.driver\.xml' \
-       -e 'CLOVER\.txt' \
-       -e '.+\.html' \
-       -e '.+\.css' \
-       -e '.+\.jceks' \
-       -e 'plain\.txt' \
-       -e 'derby\.log' \
-       -e '.+\.iml' \
+       -e 'org\.slf4j\.spi\.SLF4JServiceProvider' \
+       -e 'NOTICE\.txt\.vm' \
+       -e 'plain' \
+       -e 'KEYS' \
+       -e 'RELEASE-NOTES\.txt' \
+       -e 'README\.txt' \
        -e 'report.txt'
-
-

Reply via email to