Skip to content

Explicit list of packaged libraries #557

@jglick

Description

@jglick

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:

Suggested implementation:

  • Add a new mojo parameter for a sorted list of artifactIds corresponding to dependency JARs which ought to be bundled. (version is obvious from dependency:tree and other things; groupId could be included for clarity, though the default basename in the WAR just uses artifactId.)
  • 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 be String-valued, unless Maven has some clever way to bind a variable expression to a List<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.

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