Skip to content

Conversation

@xinhuagu
Copy link
Contributor

@xinhuagu xinhuagu commented Jun 10, 2025

Description

adds automated license validation steps in CI

( Hello, If the java.header and license-checks files are automatically used elsewhere or have other uses and it shouldn't be validated in ci, please close this PR. Thanks )

@vorburger
Copy link
Member

vorburger commented Jun 11, 2025

@xinhuagu this could be useful for #168, but are you sure that this will actually work?

This PR basically adds mvn checkstyle:check -Dcheckstyle.config.location=../license-checks.xml -Dcheckstyle.header.file=../java.header, but... there (currently) is no Checkstyle configured in this project - agreed? So... this will actually fail to build (I think; haven't tested it yet).

@xinhuagu
Copy link
Contributor Author

xinhuagu commented Jun 11, 2025

This PR basically adds mvn checkstyle:check -Dcheckstyle.config.location=../license-checks.xml -Dcheckstyle.header.file=../java.header, but... there (currently) is no Checkstyle configured in this project - agreed? So... this will actually fail to build (I think; haven't tested it yet).

@vorburger It will build. The "check" goal was directly invoked with the checkstyle.header.file parameter, even without explicit configuration in the pom.xml. It still works, however, it is the minimal change, not the optimal one.
I used checkstyle:check, which pulls the default version from Maven Central and there is an undefined property in license-checks.xml. To ensure clarity and consistency, it's indeed better to define and config the Checkstyle plugin explicitly in the pom.xml.

I updated the PR accordingly,thanks!

@xinhuagu xinhuagu marked this pull request as draft June 11, 2025 17:22
@xinhuagu xinhuagu marked this pull request as ready for review June 11, 2025 17:48
@Poggecci Poggecci self-requested a review June 16, 2025 20:24
Comment on lines +40 to +42
- name: License validation for ${{ matrix.module }}
working-directory: ./${{ matrix.module }}
run: mvn checkstyle:check -Dcheckstyle.config.location=../license-checks.xml
Copy link
Member

Choose a reason for hiding this comment

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

Let's not do this like this (i.e. running Maven twice using a Matrix), but instead wait for #155 to get merged (hopefully in the next few days already), and then simply use standard Maven? (Once there is a parent POM, Checkstyle can run on all modules.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, using a parent POM is definitely the better solution

<java-websocket.version>1.6.0</java-websocket.version>
<jackson.version>2.19.0</jackson.version>
<okhttp.version>4.12.0</okhttp.version>
<checkstyle-maven-plugin.version>3.6.0</checkstyle-maven-plugin.version>
Copy link
Member

Choose a reason for hiding this comment

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

Let's wait for #155 and then add this to the (new) root pom.xml instead of duplicating it in both the core/pom.xml as well as the dev/pom.xml ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, once the root POM is there, there's no need to repeat the version in multiple places.

<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-maven-plugin.version}</version>
<configuration>
<propertyExpansion>checkstyle.header.file=../java.header</propertyExpansion>
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about something that I have not yet understood: Will this ONLY check the java.header for the license? That would be a great! Or will this ALSO validate "code format"? That would a problem. Because the code in this repo will never (exactly) match Checkstyle code conventions. (Instead, I will add another code format checker later, see #168.) Could you double check to clarify? Tx!

Copy link
Contributor Author

@xinhuagu xinhuagu Jun 18, 2025

Choose a reason for hiding this comment

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

this checkstyle.header.file=../java.header will also valide other default rules. That would be a problem , true. Thx for pointing it out.

looking forward to #168 , i close this pr now :) thx

@xinhuagu xinhuagu closed this Jun 18, 2025
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