-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Labels
Description
Currently this plugin bundles all compile-scoped dependencies whose trail does not include a plugin in WEB-INF/lib/*.jar. #140 / #172 / #192 shows that there are subtleties here. #130 at least makes it clear what is being bundled and (usually) why to a developer paying attention to the build log, but of course most of the time no one is looking.
As suggested in jenkinsci/blueocean-plugin#2433 (comment) and jenkinsci/plugin-pom#705 (comment), it would be more reliable to simply require that the plugin pom explicitly list the JARs it expects to bundle so there needs to be a conscious decision to start bundling something and this decision is apparent to reviewers.
Some more examples of why this would be safer:
- Revert "Update hamcrest" google-compute-engine-plugin#398 / Make awaitility and hamcrest dependencies compile-scope so they are bundled in the plugin for use by gcp-client google-compute-engine-plugin#402
- [JENKINS-62767] Do not include JGit in hpi file workflow-remote-loader-plugin#18
- https://groups.google.com/g/jenkinsci-dev/c/POxcfeUTRzo/m/bRiyei3ZAgAJ
- Ban Jenkins test harness in compile scope plugin-pom#864
- published incremental poms have dependencyManagement stripped causing incorrect dependency resolution plugin-pom#705 (comment)
Suggested implementation:
- Add a new mojo parameter for a sorted list of
artifactIds corresponding to dependency JARs which ought to be bundled. (versionis obvious fromdependency:treeand other things;groupIdcould be included for clarity, though the default basename in the WAR just usesartifactId.) - If the actual list as computed by the current algorithm differs from the declared list, fail the build, printing the computed list. Otherwise proceed as now (including logging from [JENKINS-53957] Note in the build log when JARs are being bundled, and why #130, perhaps toned down).
- Define a POM property for the list in
plugin-pom(probably meaning the mojo parameter must beString-valued, unless Maven has some clever way to bind a variable expression to aList<String>). The default value should be empty. Make sure that the mojo failure message shows you the exact line you need to add to<properties>. - Prominently announce this as a breaking change for the corresponding POM release.
- File PRs for at least the most commonly maintained plugins in @jenkinsci adding the property with the current computed value. Harmless against an older POM, but makes sure that the Dependabot POM bump will pass uneventfully.
PierreBtz