elharo commented on issue #203: URL: https://github.com/apache/maven-deploy-plugin/issues/203#issuecomment-5121375629
This is not a bug in the `maven-deploy-plugin` that requires a fix in the plugin itself. It is a configuration and lifecycle invocation issue on the user's end, exposing an underlying behavior in core Maven state management (which is tracked separately). ### Root Cause The user’s CI script manually invokes `jar:jar deploy:deploy` on the command line rather than using the standard Maven lifecycle (e.g., `mvn deploy`). When `jar:jar` is executed directly from the CLI against a module with `<packaging>pom</packaging>`, it mutates Maven's internal session state, effectively tricking the project into believing it has a JAR artifact attached to it. When `deploy:deploy` executes subsequently in the same session, it attempts to deploy this non-existent or misaligned JAR artifact to the repository endpoints expected for the POM, resulting in corrupted uploads (ZIP data at `.pom` endpoints). The user explicitly verified that downgrading the deploy plugin to `3.1.1` bypassed the issue, but this was due to tighter artifact checks added in `3.1.2` rather than a regression in deployment logic. ### Resolution & Next Steps The consensus from Tamas Cservenak and the original author is that the user's CI pipeline was incorrectly bypassing standard Maven lifecycles. 1. **Deploy Plugin:** No action is needed here. The plugin is correctly deploying the artifact state it is handed by Maven core. 2. **Maven Core:** The underlying issue—that Maven allows its internal artifact state to become corrupted/broken when a user directly invokes a Mojo that contradicts the packaging type—is a valid architectural concern. It was spun out into **MNG-8138** (`Maven internal state should not allow to become "broken"`). 3. **User Mitigation:** The user resolved their build by correctly utilizing the `deploy` phase of the default lifecycle, or using `skipIfEmpty` configuration on the `maven-jar-plugin` for POM modules. You do not need to address this in `maven-deploy-plugin`. Work on preventing this state corruption is best directed at MNG-8138 in Maven core. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
