Skip to content

Add missing ASF license headers and check them with Apache RAT - #194

Merged
mraible merged 2 commits into
masterfrom
add-missing-license-headers
Sep 27, 2026
Merged

mraible merged 2 commits into
masterfrom
add-missing-license-headers

Conversation

@mraible

@mraible mraible commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

About 140 Roller-owned files were missing the ASF license header: Java sources and tests (mostly package-info.java files), JSPs, Velocity templates, Struts validation and menu XML, the ORM mappings and persistence.xml, taglib.tld, properties files, deployment descriptors, test DB scripts, the example code under docs/examples, sign-release.sh, the CodeQL configs, db-utils/pom.xml, version-rules.xml, and the NetBeans nbactions.xml files. Seven test classes used a shortened ASF notice and now have the full header. Each file gets the header in the comment style its neighbors already use.

To keep it that way, the apache-rat-plugin 0.18 is configured in the parent pom (not bound to the build, since it is slow; run mvn apache-rat:check), and a new "License headers" job in the workflow runs it on every push and PR. Its exclusions are commented in the pom.

Velocity templates need care because comments sit in rendered output:

  • Templates that emit markup or feeds (rsd.vm, popupcomments.vm, noop_decorator.vm, the menu and navbar templates) put the closing *# directly in front of their first output, the pattern the feed templates already use, so nothing they render changes.
  • Templates that begin with a directive or comment get a line break after the header, since *## would turn the next line into a line comment. For the SQL templates this adds one blank line to each generated script, which SQLScriptRunner skips.

I compared the generated database scripts before and after: they differ only by that blank line. All unit tests pass.

Excluded from RAT on purpose:

  • docker/wait-for-it.sh, the jQuery Mobile theme CSS, and roller-ui/scripts/jquery-2.1.1.min.js are third-party code with their own licenses.
  • The bundled blog themes and the starter templates in src/main/resources/themes have never carried headers because they are copied into users' editable weblog templates.
  • Prose documentation (*.md, *.adoc), images, word lists and other data files, and the generated JMeter plan.

88 Roller-owned files had no license header: Java sources and tests (including most package-info.java files), JSPs, Velocity templates, Struts validation and menu definitions, ORM mappings, properties files, deployment descriptors, a release script, CodeQL configuration, and NetBeans action files. Each now carries the header in the comment style its neighbors use.

Velocity templates put the closing *# directly in front of their first output so rendered pages and feeds are unchanged; templates that begin with a directive or comment get a line break after the header instead, which only adds a blank line to the generated SQL scripts. Third-party files keep their own licenses and are left alone: docker/wait-for-it.sh and the jQuery Mobile theme CSS, as are the bundled blog themes, whose templates are copied into users' editable weblog templates. The it-selenium module is left as is because the Playwright PR removes it.
@mraible
mraible requested a review from snoopdave September 25, 2026 17:35
@mbien

mbien commented Sep 25, 2026

Copy link
Copy Markdown
Member

we could let CI check this, e.g:

            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <version>0.18</version>
                <configuration>
                    <inputExcludes>
                        <inputExclude>/src/main/webapp/themes/*</inputExclude>
                        <inputExclude>/src/main/webapp/favicon*</inputExclude>
                        <!-- more -->
                    </inputExcludes>
                </configuration>
            </plugin>

plugin is off by default since it makes the build a bit slower, run with apache-rat:check.

The apache-rat-plugin 0.18 is configured in the parent pom but not bound to the build, since it slows it down; run it with mvn apache-rat:check. A new License headers job in the workflow runs that check on every push and pull request.

RAT found headers the earlier pass had missed, and those files now have them: the weblogger ORM mappings, persistence.xml, taglib.tld, context.xml-example, the dummy database scripts used by tests, the example code and build files under docs/examples, and the it-selenium resources. Seven test classes that used a shortened ASF notice get the full header, which RAT requires.

The exclusions are documented in the pom: prose documentation, generated and data files, the bundled theme templates that users copy and edit, images, and third-party code with its own license.
@mraible

mraible commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Good idea, done. The apache-rat-plugin 0.18 is in the parent pom's pluginManagement, not bound to the build, so mvn apache-rat:check runs it, and a new "License headers" job in the workflow runs that check on every PR.

RAT caught files my first pass missed, which now have headers: the weblogger ORM mappings, persistence.xml, taglib.tld, context.xml-example, the dummy test DB scripts, and the docs/examples code. It also rejected the shortened ASF notice seven test classes used, so those have the full header now.

The exclusions are commented in the pom: prose docs (*.md, *.adoc), the bundled themes and the starter templates in src/main/resources/themes, SVGs, third-party code (wait-for-it.sh, jQuery Mobile's CSS, the old jquery-2.1.1.min.js), data files like the word lists and the OPML sample, and the generated JMeter plan. apache-rat:check passes on all three modules.

@mraible mraible changed the title Add the ASF license header to source files that were missing it Add missing ASF license headers and check them with Apache RAT Sep 26, 2026

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. let's merge this

@mraible
mraible merged commit 4b5600c into master Sep 27, 2026
8 checks passed
@mraible
mraible deleted the add-missing-license-headers branch September 27, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants