Add SonatypeCredentialsModule, MavenPublish and MavenPublishModule #6023
+239
−79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements #5592 and builds upon #5601.
High Level Overview of Changes
This PR implements three traits:
MavenPublishModuleis meant to mirrorSonatypeCredentialsModulefor plain (!?) Maven repositoriesMavenModulecontains the actual publishing logic. This has been taken from parts ofSonatypeCredentialsModuleand is now extended by bothMavenPublishModuleas well assSonatypeCredentialsModuleto share codeSonatypeCredentialsModulecontains tasks for obtaining Sonatype credentials. These tasks have been extracted from theSonatypeCentralPublishModuleto be shared by both it and the newMavenPublishModuleDifferences between this PR and #5601
Code Structure
#5601 essentially copied parts of
SonatypeCredentialsModuleto createMavenPublishModule. 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,mavenReadTimeoutandmavenAwaitTimeoutas part of theMavenPublishModule. These are however not actually used anywhere. They are used inSonatypeCentralPublishModuleand 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.
Open Question: Build Compilation Error When Extending
MavenPublishModuleWhen running
./mill dist.installLocalCacheand then using the localSNAPSHOTversion of mill including the changes made in this PR in a build and extendingMavenPublishModulein a local build module, I currently get the following exception when running./mill resolve _on that build:This error can be removed by defining
Deps.sonatypeCentralClientas amvnDepsinstead of both acompileMvnDepsand arunMvnDepsinlibs/scalalib/package.millandlibs/javalib/package.mill. I do not know why this is the case and would require some help here.