Skip to content

Conversation

@maxstreese
Copy link

@maxstreese maxstreese commented Oct 24, 2025

Summary

Implements #5592 and builds upon #5601.

High Level Overview of Changes

This PR implements three traits:

  • MavenPublishModule is meant to mirror SonatypeCredentialsModule for plain (!?) Maven repositories
  • MavenModule contains the actual publishing logic. This has been taken from parts of SonatypeCredentialsModule and is now extended by both MavenPublishModule as well ass SonatypeCredentialsModule to share code
  • SonatypeCredentialsModule contains tasks for obtaining Sonatype credentials. These tasks have been extracted from the SonatypeCentralPublishModule to be shared by both it and the new MavenPublishModule

Differences between this PR and #5601

Code Structure

#5601 essentially copied parts of SonatypeCredentialsModule to create MavenPublishModule. Apart from duplicating code, this also created code you may find confusing in places (e.g. by containing a function named publishSnapshot which is used to publish both release and snapshot artifacts). This PR tries to improve upon that by instead factoring out all code which can be factored out.

Removal of Unused Settings

#5601 defines the tasks mavenConnectTimeout, mavenReadTimeout and mavenAwaitTimeout as part of the MavenPublishModule. These are however not actually used anywhere. They are used in SonatypeCentralPublishModule and are specific to publishing releases to Sonatype Central.

Bugfix for Choosing the Repo URI

The below was changed after being identified during testing with a private build.

- val uri = if (isSnapshot) releaseUri else snapshotUri
+ val uri = if (isSnapshot) snapshotUri else releaseUri

Open Question: Build Compilation Error When Extending MavenPublishModule

When running ./mill dist.installLocalCache and then using the local SNAPSHOT version of mill including the changes made in this PR in a build and extending MavenPublishModule in a local build module, I currently get the following exception when running ./mill resolve _ on that build:

[build.mill-59] [error] ## Exception when compiling 23 sources to /home/max/Repositories/github.com/ttmzero/rtp-backend/out/mill-build/compile.dest/classes
[build.mill-59] [error] dotty.tools.dotc.core.MissingType: Cannot resolve reference to type com.lumidion.sonatype.central.client.core.type.SonatypeCredentials.
[build.mill-59] [error] The classfile defining the type might be missing from the classpath.

This error can be removed by defining Deps.sonatypeCentralClient as a mvnDeps instead of both a compileMvnDeps and a runMvnDeps in libs/scalalib/package.mill and libs/javalib/package.mill. I do not know why this is the case and would require some help here.

@maxstreese
Copy link
Author

Hi @lefou, this is my attempt at implementing #5592, building upon @chikei's work in #5601. In the end it does contain quite a few more changes. I hope that's ok, this is what I could come up with. Let me know if this is a non starter or what changes are required to get this merged.

Many thanks (also to @chikei)!

@maxstreese maxstreese changed the title Add SonatypeCredentialsModule, MavenPublsh and MavenPublishModule Add SonatypeCredentialsModule, MavenPublish and MavenPublishModule Oct 25, 2025
@maxstreese
Copy link
Author

Hi @lefou I provided more details in the PR description and fixed a bug. Please have a look! Regarding the open question mentioned in the description I would require some pointers.

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.

1 participant