Optionally ban JUnit 4 imports - #1178
Conversation
|
Perhaps something similar could be done for |
|
@timja Any suggestions or preferences for naming before we lock this in forever? |
|
Name looks good |
|
FTR I have no intention of doing any sort of larger-scale migration or other followup for this. This is just intended as an additional safeguard for changes like the ones I pointed out in the PR comment (and IMO is almost a prerequisite to accepting them). |
Thanks for doing this 👍🏼 |
|
@daniel-beck FYI, causes: https://github.com/jenkinsci/generic-webhook-trigger-plugin/pull/369/checks?check_run_id=48162665919 I'll create a follow-up to fix it if you don't mind. |
Ban JUnit 4 imports To prevent regressions when adding new tests, jenkinsci/plugin-pom#1178 introduced a new flag that enables a Maven Enforcer rule banning org.junit.* imports while allowing org.junit.jupiter.*. With this change, the build will fail if any org.junit.* imports are introduced.
This PR adds a new property
ban-junit4-imports.skip. Similar tospotless.check.skipbefore it, it istrueby default. If overridden, an enforcer rule banningorg.junit.*imports, but allowingorg.junit.jupiter.*imports, is run.It's motivated by PRs like jenkinsci/matrix-auth-plugin#175 or jenkinsci/csp-plugin#48 that look far too easy to regress. Going via parent POM seems like the logical choice.
Feedback welcome. If this looks acceptable in principle, I'll look into where best to document this, as well as adding tests.
Testing done
Installed a snapshot locally, then:
Failure error message output
Submitter checklist