Add distribution management for the Maven Central release and the sna…#102
Add distribution management for the Maven Central release and the sna…#102ivargrimstad merged 1 commit intoeclipse-ee4j:mainfrom
Conversation
…pshot repository. Signed-off-by: James R. Perkins <jperkins@ibm.com>
|
@ivargrimstad Hopefully this should work. I'm not sure how we test it. |
|
oh so about publishing with those "other methods", here's what we've done at Hibernate, e.g. and then the Jenkins file calls the deploy goal as: 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 |
|
Interesting. It was my understanding that you had to use the |
|
Oh, right. The regular deploy plugin only works for snapshots, and for releases, it's the central publishing API (be it through |
|
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". |
| <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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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
Line 239 in 68e0f1f
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…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
snapshotRepositorydefinition.