Skip to content

Conversation

@perNyfelt
Copy link

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.

    • Adds support for the new central portal publish api including unit and integration tests.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.

This PR adds support for the new central portal publish api described here: https://central.sonatype.org/publish/publish-portal-api/. Essentially it generates checksum files for all artifacts, creates a zip bundle and uploads that to central.
All the current functionality remains intact and the result is controlled with a few additional properties i.e.

  • The deployAtEnd (that existed before) determines whether all sub-projects should be deployed in one go or not.
  • The new property useCentralPortalApi determines whether the Deploy plugin should behave as it does currently (useCentralPortalApi=false) or behave as per the requirements of the central portal publish api (useCentralPortalApi=true).
  • autoDeploy if set to true the deployment will automatically proceed to publish after validation. If false it will wait for manual action at central.
  • uploadToCentral if set to false, only the zip bundle will be created but not deployed to central.

Both unit tests and IT tests have been created to clearly showcase (and test) the new functionality.

  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.

Both sunny and rainy day unit tests have been created. IT tests cover only sunny day scenarios.

  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

ICLA already exists.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

perNyfelt and others added 24 commits July 23, 2025 20:49
…entralReleaseMojo.java as the functionality is now fully integrated with the DeployMojo.
…loyMojo and remove CentralBundleMojo. Fix verify scripts in central-zip-bundles and central-zip-megabundle.
@perNyfelt perNyfelt changed the base branch from master to maven-deploy-plugin-3.x August 8, 2025 13:03
}
}

public File generateChecksum(File file, String algo) throws NoSuchAlgorithmException, IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You really want to redo what Resolver does for you out of the box?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, i want to reuse as much existing functionality as possible of course :) I'll try to use resolver for checksums instead then thanks!

* <li>Developers information</li>
* </ul>
*/
private void validateForPublishing(File pomFile) throws MojoExecutionException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation is off: license, SCM, developers are usually defined in top level POM only

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll adjust it if it does not get too complex. Otherwise i'll remove this and let central validation handle it.

}
}

private String[] resolveCredentials(String serverId) throws MojoExecutionException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP proxy?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we perhaps use a library for the upload communication part. httpclient perhaps?

while ((bytesRead = is.read(buffer)) != -1) {
dos.write(buffer, 0, bytesRead);
public List<File> generateChecksums(File file, List<String> algos) throws IOException {
Map<String, Object> results = ChecksumUtils.calc(file, algos);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@perNyfelt
Copy link
Author

Retracted after discussion on the dev list.

@perNyfelt perNyfelt closed this Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants