Skip to content

[Improvement]: Enforce build constraints using maven-enforcer-plugin #4030

@davedwwang

Description

@davedwwang

Search before asking

  • I have searched in the issues and found no similar issues.

What would you like to be improved?

Currently, in the Apache Amoro project, if the JUnit 5 API is used but the corresponding junit-jupiter-engine is missing (or similarly for JUnit 4 and junit-vintage-engine), Maven Surefire might silently ignore the test cases. This leads to a false sense of security where the build passes even if tests are not actually executed.

To improve the robustness of the CI/CD pipeline and ensure all tests are strictly executed, we should enforce the presence of these engines during the build's validate phase.

How should we improve?

  1. Introduce maven-enforcer-plugin: Add the plugin to the amoro-ams (or root) pom.xml.
  2. Add JUnit 5 Engine Check: Ensure that if the project has dependencies, it must contain junit-jupiter-engine to prevent silent ignoring of JUnit 5 tests.
  3. Add JUnit 4 Engine Check: Ensure that junit-vintage-engine is present to support the execution of legacy JUnit 4 tests.
  4. Align with Apache Paimon Security Standards: Referenced the security practices of Apache Paimon to introduce stricter dependency validation.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Subtasks

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions