Skip to content

upgrade 3.2.6 corrupts published parent pom artifact #40952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tubbynl opened this issue May 30, 2024 · 8 comments
Closed

upgrade 3.2.6 corrupts published parent pom artifact #40952

tubbynl opened this issue May 30, 2024 · 8 comments
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue

Comments

@tubbynl
Copy link

tubbynl commented May 30, 2024

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 #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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 30, 2024
@wilkinsona
Copy link
Member

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 #40919.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels May 30, 2024
@tubbynl
Copy link
Author

tubbynl commented May 30, 2024

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 :)

@wilkinsona
Copy link
Member

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.

@tubbynl
Copy link
Author

tubbynl commented May 30, 2024

ah yes; will report it when my account gets approved :)

@tubbynl
Copy link
Author

tubbynl commented Jun 3, 2024

@cstamas
Copy link

cstamas commented Jun 4, 2024

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

@tubbynl
Copy link
Author

tubbynl commented Jun 4, 2024

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

@tubbynl
Copy link
Author

tubbynl commented Jun 4, 2024

thank you for your helpfull insights @cstamas 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants