gnodet-bot commented on code in PR #719:
URL:
https://github.com/apache/maven-deploy-plugin/pull/719#discussion_r4237222072
##########
src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java:
##########
@@ -446,19 +448,20 @@ private ArtifactDeployerRequest createDeployerRequest() {
if (attachedArtifacts.isEmpty()) {
throw new MojoException(
"The packaging for this project did not assign
a file to the build artifact");
+ } else if (usesModuleSourceHierarchy(project,
projectManager)) {
+ getLog().info("Module source hierarchy: no main
artifact produced;"
+ + " deploying POM and per-module artifacts
only.");
+ toDeploy.remove(deployable);
+ } else if (allowIncompleteProjects) {
+ getLog().warn("");
+ getLog().warn("The packaging plugin for this project
did not assign");
+ getLog().warn("a main file to the project but it has
attachments. Change packaging to 'pom'.");
+ getLog().warn("");
+ getLog().warn("Incomplete projects like this will fail
in future Maven versions!");
+ getLog().warn("");
Review Comment:
⚠️ **Missing `toDeploy.remove(deployable)`:** The adjacent
`usesModuleSourceHierarchy` branch (line 454) calls
`toDeploy.remove(deployable)` before continuing. This branch does not, so the
artifact (which has no valid file path) remains in `toDeploy` and will be
passed to the deployer — likely causing a failure.
```suggestion
} else if (allowIncompleteProjects) {
toDeploy.remove(deployable);
getLog().warn("");
getLog().warn("The packaging plugin for this project
did not assign");
getLog().warn("a main file to the project but it has
attachments. Change packaging to 'pom'.");
getLog().warn("");
getLog().warn("Incomplete projects like this will
fail in future Maven versions!");
getLog().warn("");
```
--
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]