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. |
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.
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.
### Ban JUnit 4 imports To prevent regressions when adding new tests, [jenkinsci/plugin-pom#1178](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. ### Testing done None. Rely on `ci.jenkins.io`. ### Submitter checklist * [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch! * [x] Ensure that the pull request title represents the desired changelog entry * [x] Please describe what you did * [ ] Link to relevant issues in GitHub or Jira * [x] Link to relevant pull requests, esp. upstream and downstream changes * [ ] Ensure you have provided tests that demonstrate the feature works or the issue is fixed
To prevent regressions when adding new tests, [jenkinsci/plugin-pom#1178](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. None. Rely on `ci.jenkins.io`. * [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch! * [x] Ensure that the pull request title represents the desired changelog entry * [x] Please describe what you did * [ ] Link to relevant issues in GitHub or Jira * [x] Link to relevant pull requests, esp. upstream and downstream changes * [ ] Ensure you have provided tests that demonstrate the feature works or the issue is fixed
To prevent regressions when adding new tests, [jenkinsci/plugin-pom#1178](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. None. Rely on `ci.jenkins.io`. * [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch! * [x] Ensure that the pull request title represents the desired changelog entry * [x] Please describe what you did * [ ] Link to relevant issues in GitHub or Jira * [x] Link to relevant pull requests, esp. upstream and downstream changes * [ ] Ensure you have provided tests that demonstrate the feature works or the issue is fixed
To prevent regressions when adding new tests, [jenkinsci/plugin-pom#1178](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. None. Rely on `ci.jenkins.io`. * [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch! * [x] Ensure that the pull request title represents the desired changelog entry * [x] Please describe what you did * [ ] Link to relevant issues in GitHub or Jira * [x] Link to relevant pull requests, esp. upstream and downstream changes * [ ] Ensure you have provided tests that demonstrate the feature works or the issue is fixed
To prevent regressions when adding new tests, [jenkinsci/plugin-pom#1178](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. None. Rely on `ci.jenkins.io`. * [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch! * [x] Ensure that the pull request title represents the desired changelog entry * [x] Please describe what you did * [ ] Link to relevant issues in GitHub or Jira * [x] Link to relevant pull requests, esp. upstream and downstream changes * [ ] Ensure you have provided tests that demonstrate the feature works or the issue is fixed
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