You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "EnigmaTriton (via GitHub)" <gi...@apache.org> on 2024/06/13 17:49:24 UTC
Re: [PR] [MDEPLOY-311] Pass on 'packaging' when creating artifact to upload [maven-deploy-plugin]
EnigmaTriton commented on code in PR #42:
URL: https://github.com/apache/maven-deploy-plugin/pull/42#discussion_r1638662304
##########
src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java:
##########
@@ -274,9 +274,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
classifier = artifactType.getClassifier();
}
}
- Artifact mainArtifact = new DefaultArtifact(
- groupId, artifactId, classifier, isFilePom ? "pom" : getExtension(file), version)
- .setFile(file);
+ Artifact mainArtifact = new DefaultArtifact(groupId, artifactId, classifier, packaging, version).setFile(file);
Review Comment:
According to the [documentation|https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html], `packaging` designate the “Type of the artifact to be deployed. Retrieved from the <packaging> element of the POM file if a POM file specified. Defaults to the file extension if it is not specified via command line or POM.”
The way I read it, it means that the `packaging` tag takes precedence (whether from command line or from the POM), followed by the extension of the file to upload as a fallback.
I just hit this issue (MDEPLOY-311) because we generate a zip file using the truezip plugin (that relies on the extension) and then we need to deploy using a different extension.
The `.epub` ebooks (used for documentation) are really `.zip` files with a specific content but this is true for quite a lot of other formats as well so there really is a use-case for using `<packaging>` with a different extension than the one on the deployed file.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org