Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Dec 4, 2025

Migrate to spotless which offers a bit more than just simple formatting, especially on pom files and other non java source files.

Replace formatter-maven-plugin and impsort-maven-plugin with spotless-maven-plugin.
Spotless provides a more modern and flexible approach to code formatting.

Configuration:
- Use Palantir Java Format (version 2.50.0) for consistent Java formatting
- Enable removeUnusedImports to clean up unnecessary imports
- Configure importOrder to match current convention:
  java, jakarta, javax, org.w3c, org.xml, junit, then others
- Add license header enforcement using the Apache License 2.0 template

Plugin is configured in root pom.xml pluginManagement and inherited by
all child modules.

Profile changes in parent/pom.xml:
- sourcecheck profile: uses spotless:check to validate formatting
- full profile: uses spotless:apply to auto-format during build

The legacy formatter and impsort plugins remain configured for backward
compatibility but are no longer used in the default profiles.
Apply Palantir Java Format to all Java source files using Spotless.

Changes applied:
- Consistent code formatting according to Palantir style
- Removed unused imports
- Organized imports according to project convention
- Ensured all files have the proper Apache License 2.0 header

This is a large-scale formatting change affecting approximately 21,000
Java source files to establish a consistent code style baseline.
Add a dedicated workflow to check code formatting on pull requests
targeting main and LTS branches (camel-4.4.x, camel-4.8.x, camel-4.10.x,
camel-4.14.x).

The workflow:
- Triggers only when Java files are modified
- Runs spotless:check via the sourcecheck profile
- Provides helpful guidance in the job summary when formatting fails
- Includes concurrency control to cancel obsolete runs

This ensures all PRs conform to the project's formatting standards
before they can be merged.
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant