i have an internal parent pom for extra version management and build plugin config; which i update upon release of spring-boot versions; currently i sync with 3.1.x, 3.2.x and also the 3.3.0.
we publish the parent pom (among other jar artifacts) from this repo into the gitlab package registry using the following maven command
mvn jar:jar deploy:deploy -pl $MAVEN_MODULES -DaltDeploymentRepository=gitlab-maven::$MAVEN_REPOSITORY
this works using spring-boot 3.1.10, 3.1.11, 3.2.5 but does not work with 3.2.6 and 3.3.0, the resulting pom's before publishing are correct (checked CI pipeline files) but after publish it's a kind of binary format (not XML) in the package registry; yielding the following maven error upon using the pom.
[FATAL] Non-parseable POM ~/.m2/repository/nl/intractief/intr-parent/7.1.5/intr-parent-7.1.5.pom: only whitespace content allowed before start tag and not P (position: START_DOCUMENT seen P... @1:2) @ ~/.m2/repository/nl/intractief/intr-parent/7.1.5/intr-parent-7.1.5.pom, line 1, column 2
invoking mvn install locally and using that works, and setting
<properties>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
</properties>
also works for 3.2.6 and 3.3.0 (i found this fix in https://github.com/spring-projects/spring-boot/issues/40919 that is probably related), so it's probably also relevant for 3.1.12 (not tested)
i think it is an issue the maven-deploy-plugin:3.1.2 upgrade, i will try to raise an issue there but i dont have an account yet.
Comment From: wilkinsona
i think it is an issue the maven-deploy-plugin:3.1.2 upgrade, i will try to raise an issue there but i dont have an account yet.
I think so too. This should be reported to the maintainers of the deploy plugin if someone has not already done so. Duplicates https://github.com/spring-projects/spring-boot/issues/40919.
Comment From: tubbynl
tnx, my account is pending approval at apache, will report. #40919 talks about a jar being published to a wrong (artifactory) endpoint, this is pom being corrupted upon publishing but it could very well both have the same cause. reported here mainly if people encounter the same error :)
Comment From: wilkinsona
The errors in the two cases are almost identical:
only whitespace content allowed before start tag and not P (position: START_DOCUMENT seen P... @1:2)
only whitespace content allowed before start tag and not P (position: START_DOCUMENT seen P... @1:1)
In each case, I believe that the deploy plugin is uploading a pom file but with jar file content.
Comment From: tubbynl
ah yes; will report it when my account gets approved :)
Comment From: tubbynl
https://issues.apache.org/jira/browse/MDEPLOY-318
Comment From: cstamas
Well, here we face a multiple issues, and none of the are Maven or Deploy plugin related...
The MDEPLOY-318 reproducer does not work, in a sense, that m-deploy-p 3.1.1 nor 3.1.2 does not reproduce the issue mentioned here. It seems it is more the CI yaml script of user that causes this issue: https://gitlab.com/tub/test-maven-deploy/-/blob/f52e59829afd61a1294a4373ba7d752ecb97ebd5/.gitlab-ci.yml
Notice how user explicitly invoked jar:jar goal in after-script, this tells Maven "do create a JAR for me", and is basically circumventing lifecycle, that would go goal -> packaging -> lifecycle -> plugin invocation indirection. The POM has packaging=pom, but user forces Maven to make a JAR for it, which it obeys...
Maven should be used by invoking lifecycles, not (kinda like Ant) invoking plugins directly, see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
Comment From: tubbynl
thank you
for the record; it does seem to publish correctly if i omit the jar:jar mojo for the tester project on https://gitlab.com/tub/test-maven-deploy i need to test it on the full project (multi-module containing the parent pom and other jar modules)
we've explicitly split it up like this to prevent triggering full project rebuilds in the after_script part
Comment From: tubbynl
thank you for your helpfull insights @cstamas 👍