Skip to content

build: add license-header check to the build (#343) - #345

Merged
AndreasIgel merged 7 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1791762049-license-header-check
Oct 12, 2026
Merged

AndreasIgel merged 7 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1791762049-license-header-check

Conversation

@igel-devin-ai

@igel-devin-ai igel-devin-ai commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Implements #343.

Adds com.mycila:license-maven-plugin 5.1.2 with a single check execution, like PrimeFaces does it. The plugin is declared per module (core, processor, example, example-custom-generator, performance-test) and once at the root so mvn license:check / mvn license:format resolve cleanly when invoked from the repository root (the root aggregator checks 0 files; modules check their own src/).

  • LICENSE.txt is the header source — no separate header file needed, since its content is byte-identical to the header comment every file carries.
  • Copyright is a uniform Copyright (c) 2025-2026 Andreas Igel range in LICENSE.txt and all 236 source files (project inception January 2025). Because every file carries the identical line, the strict literal match is the right enforcement — the earlier headerSections config (loose ensureMatch regex, 2026 defaultValue) was removed from all POMs: it would have tolerated stale years and written 2026 into new files via license:format.
  • licenseSet includes src/main/java/** and src/test/java/** per module; excludes generated-example-builder/** and target/**.
  • performance-test (profile-gated, not part of the default build) additionally excludes its generated roots: the DTO tree src/main/java/.../performance_test/library/** produced by generate_classes.py, and the annotation-processor output generated-performance-builder/**. The pipeline runs mvn -B license:check -Pperformance-test as a separate step so this module is checked in CI without being built.
  • Short mvn license:check / mvn license:format section added under Code Style in docs/CONTRIBUTING.md.

license:format was run: it added the header to the files that were missing it and normalized headers with corrupted license text (FormattingMode, LibraryHelperDto, PackageScopesTest, FormattingModeTest). Two files (ResolvedBuilder, BuilderInstantiation) carried Apache 2.0 headers — they now have the project-wide MIT header like every other file. After merging #312, the check also normalized nine MapStruct SPI files whose headers carried a shortened variant of the license text (e.g. MapStructBuilderProvider, SimpleBuildersSpiIntegration, PersonDtoMapper). The uniform-range update normalized the remaining variants (Copyright (c) 2025 Andreas Igel in BuilderProcessorTest, MethodConflictResolutionTest, and all 2026-only headers) to 2025-2026.

Verified: mvn -B install -Pmetrics passes with the check bound into verify (232 files checked, 0 missing); mvn -Pperformance-test license:check runs on all 6 reactor projects; a source file without a header fails the build, while a headerless file under the generated performance_test/library tree passes as intended.

Written by Devin

Adds com.mycila:license-maven-plugin (5.1.2) with a single check
execution, wired per module like PrimeFaces. Header text lives in
conf/header.txt; a COPYRIGHT_LINE header section accepts the existing
copyright-year variants (2025, 2025-2026, without "(c)") while new
files get the canonical line via license:format.

Includes cover src/main/java/** and src/test/java/** per module; the
generated example-builder tree and target/ are excluded. Missing or
corrupted headers (including two files carrying Apache 2.0 headers)
were normalized by license:format.
LICENSE.txt is byte-identical to the header text, so point the plugin
at it and drop conf/header.txt. The header-section key is the literal
copyright line itself, keeping per-file year variants valid.
…#343)

The merged java-helpers#312 files carry a shortened variant of the MIT text; the
new license check flagged them in CI. license:format rewrites them to
the canonical header.
…ers#343)

The module is activated only by the performance-test profile and has no
committed Java sources; its DTOs are generated into src/main/java/.../
performance_test/library/** by generate_classes.py and builder output
lands in generated-performance-builder/. Both generated roots are
excluded so generated files are never flagged.
…ava-helpers#343)

The module only enters the reactor under the performance-test profile,
which CI never enables. A dedicated license:check step with the profile
active covers it without building the module.
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

…ction config (java-helpers#343)

- normalize all source headers and LICENSE.txt to Copyright (c) 2025-2026
- remove headerSections from all pom.xmls: strict literal match against
  LICENSE.txt enforces the uniform range; the loose ensureMatch regex and
  2026 defaultValue would have let or written stale years
- delete accidentally added empty .mvn/maven.config
@AndreasIgel
AndreasIgel merged commit bf012d2 into java-helpers:main Oct 12, 2026
6 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants