Skip to content

Add distribution management for the Maven Central release and the sna…#102

Merged
ivargrimstad merged 1 commit intoeclipse-ee4j:mainfrom
jamezp:add-dist-mgmt
Sep 23, 2025
Merged

Add distribution management for the Maven Central release and the sna…#102
ivargrimstad merged 1 commit intoeclipse-ee4j:mainfrom
jamezp:add-dist-mgmt

Conversation

@jamezp
Copy link
Copy Markdown
Member

@jamezp jamezp commented Sep 22, 2025

…pshot repository.

I've not personally released a SNAPSHOT so hopefully this is correct. I pulled the info from https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-via-other-methods which doesn't show it being in the snapshotRepository definition.

…pshot repository.

Signed-off-by: James R. Perkins <jperkins@ibm.com>
@jamezp
Copy link
Copy Markdown
Member Author

jamezp commented Sep 22, 2025

@ivargrimstad Hopefully this should work. I'm not sure how we test it.

@marko-bekhta
Copy link
Copy Markdown
Contributor

marko-bekhta commented Sep 22, 2025

oh so about publishing with those "other methods", here's what we've done at Hibernate, e.g.

https://github.com/hibernate/hibernate-validator/blob/58067df08133043a387e26d8408156b0de11603b/pom.xml#L1639-L1643

and then the Jenkins file calls the deploy goal as:

https://github.com/hibernate/hibernate-release-scripts/blob/27aea1b46366524a392fedea628bffb98a897e07/snapshot-deploy.sh#L25

and it's with a regular maven deploy plugin, no need to use the central publishing for that ...

EDIT: but then that doc also suggests that central-publishing-maven-plugin should support the snapshots, so hopefuly that works 🙂 🤞🏻

@jamezp
Copy link
Copy Markdown
Member Author

jamezp commented Sep 22, 2025

Interesting. It was my understanding that you had to use the central-publishing-maven-plugin or the API to deploy to central.sonatype.com. The plugin works as an extension though so you still use the deploy phase.

@marko-bekhta
Copy link
Copy Markdown
Contributor

Oh, right. The regular deploy plugin only works for snapshots, and for releases, it's the central publishing API (be it through central-publishing-maven-plugin or some other thing like JReleaser....
soooo I think what you have here should do the trick 🙂 and since it's a snapshot release we could try it on any of the specs projects, right? ( I don't mind testing on validation since I wanted snapshots anyway 🙈 🙂 🤞🏻)

@marko-bekhta
Copy link
Copy Markdown
Contributor

oh and one more thing to keep in mind about the snapshots on Central 🙂 those are short-lived and are removed after 90 days.. so if we'd need to rely on snapshots somewhere, but don't do super active development, we may need some cron build to rebuild the snapshots so they are sort of "always there".

@ivargrimstad ivargrimstad merged commit 68e0f1f into eclipse-ee4j:main Sep 23, 2025
1 check passed
Comment on lines +113 to +135
<distributionManagement>
<snapshotRepository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>${repo.sonatype.url}/repository/maven-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</snapshotRepository>
<repository>
<id>central</id>
<url>${repo.sonatype.url}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</distributionManagement>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not think this is necessary. The documentation for the central-publishing-maven-plugin shows these as the default properties for the plugin, and using <distributionManagement> as a way to send snapshots/releases to alternative repositories. See: https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-with-the-central-publishing-maven-plugin

Instead, the parent pom should come with a <repositories> element that directs children on how to consume releases/snapshots.

Copy link
Copy Markdown
Member Author

@jamezp jamezp Sep 23, 2025

Choose a reason for hiding this comment

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

I think it has something to do with the maven-deploy-plugin. On https://ci.eclipse.org/ee4j/job/ee4j-parent-release-snapshot/3/console there was an error that seemed to indicate that distributionManagement was required:

[WARNING] The requested profile "release" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.2:deploy (default-deploy) on project project: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::url parameter -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Maybe this should be defined in a profile named release, but it does seem to be needed.

Copy link
Copy Markdown
Member

@KyleAure KyleAure Sep 23, 2025

Choose a reason for hiding this comment

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

@jamezp - Why is the maven-deploy-plugin being used, shouldn't the central-publishing-maven-plugin take over the deploy goal?

When I look at the job that was run I see the maven goal was:

/opt/tools/apache-maven/latest/bin/mvn -f parent/pom.xml -Prelease deploy

But the profile -Prelease does not exist in the parent pom, it should be -Poss-release

<id>oss-release</id>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well, the central-publishing-maven-plugin is set as an extension, <extension>true</extension> so it forks the deploy phase. I misspoke about the it being the maven-deploy-plugin that is the issue.

I do understand it says the defaults are there, but it didn't seem to work :) IMO it's better to be explicit anyway. That is just my opinion though.

For the profile, I don't have access to change the job so I can't fix that.

Copy link
Copy Markdown
Member

@KyleAure KyleAure Sep 23, 2025

Choose a reason for hiding this comment

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

I do understand it says the defaults are there, but it didn't seem to work :) IMO it's better to be explicit anyway. That is just my opinion though.

I'm fine with it being there, just wanted to point out it should not be necessary. But to be clear the failure on jenkins build is due to the incorrect profile and should not be due to the <distributionManagement> not being defined.

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.

4 participants