Skip to content

[deploy] Do not require -source.jar and -javadoc.jar for jars having no classes or resources #1751

@ppalaga

Description

@ppalaga

If a jar file contains no classfiles or other kinds of resources, then nobody would ever need JavaDoc or sources for them. That's also the reason why Maven Central does not require sources/javadoc for such jars.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem (link to git repository is ideal)
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a maven module with packaging jar having no src directory, make sure maven-source-plugin and maven-javadoc-plugin are in place. https://github.com/quarkiverse/quarkus-cxf/tree/3.15.0/extensions/xjc-plugins/deployment can serve as an example (note the 3.15.0 tag - the current main adds a dummy resource to workaround this issue)
  2. mvn package
  3. See that there is a .jar file in targer folder, but no -source.jar or -javadoc.jar files
  4. Try to deploy this module to Central using jreleaser

Expected Behaviour

The deployment should pass

Actual Behaviour

The deployment fails with something like

deploy_to_central	Deploy to Central	2024-10-24T11:11:09.2661438Z ☕ java -jar jreleaser-cli.jar deploy
deploy_to_central	Deploy to Central	2024-10-24T11:11:09.5789965Z jreleaser 1.15.0-SNAPSHOT. Consider becoming a sponsor at https://opencollective.com/jreleaser
deploy_to_central	Deploy to Central	2024-10-24T11:11:09.6034918Z [INFO]  JReleaser 1.15.0-SNAPSHOT
deploy_to_central	Deploy to Central	2024-10-24T11:11:09.6041437Z [INFO]  Configuring with jreleaser.yml
deploy_to_central	Deploy to Central	2024-10-24T11:11:09.6044305Z [INFO]    - basedir set to /home/runner/work/quarkiverse-release/quarkiverse-release
deploy_to_central	Deploy to Central	2024-10-24T11:11:09.6047724Z [INFO]    - outputdir set to /home/runner/work/quarkiverse-release/quarkiverse-release/out/jreleaser
deploy_to_central	Deploy to Central	2024-10-24T11:11:09.6129010Z [INFO]  Reading configuration
deploy_to_central	Deploy to Central	2024-10-24T11:11:10.2138664Z [INFO]  git-root-search set to false
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.3308639Z [INFO]  Loading variables from /home/runner/.jreleaser/config.properties
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.3312109Z [WARN]  Variables source /home/runner/.jreleaser/config.properties does not exist
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.3327165Z [INFO]  Validating configuration
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.3329293Z [INFO]  Strict mode set to false
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4079064Z [INFO]  Project version set to 3.16.0
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4081388Z [INFO]  Release is not snapshot
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4083815Z [INFO]  Timestamp is 2024-10-24T11:11:10.164813252Z
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4086078Z [INFO]  HEAD is at f1f3a7d
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4088290Z [INFO]  Platform is linux-x86_64
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4108460Z [INFO]  dry-run set to false
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4125469Z [INFO]  Deploying Maven artifacts
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4127203Z [INFO]    [maven] Deploying all staged artifacts
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4197165Z [INFO]      [nexus2] Deploying to maven-central
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.4199245Z [INFO]      [nexus2] nexus2 set to FULL_DEPLOYMENT
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.6971018Z [INFO]      [nexus2] Verifying prerequisites
deploy_to_central	Deploy to Central	2024-10-24T11:11:13.7005527Z [INFO]      [nexus2] Verifying POMs
Error: to_central	Deploy to Central	2024-10-24T11:13:04.6675130Z [ERROR]     [nexus2] quarkus-cxf-xjc-plugins-deployment-3.16.0-sources.jar is missing
deploy_to_central	Deploy to Central	2024-10-24T11:13:04.6680609Z [INFO]  Writing output properties to out/jreleaser/output.properties
Error: to_central	Deploy to Central	2024-10-24T11:13:04.6765332Z [ERROR] JReleaser failed after 01:51 m
deploy_to_central	Deploy to Central	2024-10-24T11:13:04.6778534Z Rules for publishing to Maven Central were not met
Error: Process completed with exit code 1.

Environment Information

  • Operating System: any
  • JReleaser Version: early-access as of today
  • JDK Version: 17

Possible workarounds

Workaround A

A dummy resource will trigger the creation of -source.jar and -javadoc.jar artifacts.

mkdir -p src/main/resources
touch src/main/resources/make-jreleaser-happy

Workaround B

define artifactOverrides as described in the guide https://jreleaser.org/guide/latest/reference/deploy/maven/nexus2.html

as recommended by @aalmiray. I must say I find this a bit tedious. There should be a general (ideally default) way to allow this. Moreover, in my case, the jreleaser setup is out of my control. It is managed by another team for tens of projects and hundreds of modules. It is not going to scale to add/remove the exceptions for every module that happens to have no classes at some point in time.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions