slawekjaranowski commented on code in PR #42:
URL: 
https://github.com/apache/maven-deploy-plugin/pull/42#discussion_r1310863949


##########
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:
   Please look at java doc: 
https://maven.apache.org/resolver/apidocs/org/eclipse/aether/artifact/DefaultArtifact.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
   
   fourth parameter is a file extension not packaging



##########
src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java:
##########
@@ -276,6 +276,45 @@ public void testDeployIfArtifactIsNotJar() throws 
Exception {
         assertTrue(file.exists());
     }
 
+    public void testDeployFileIfPackagingIsSet() throws Exception {
+        File testPom = new File(getBasedir(), 
"target/test-classes/unit/deploy-file-packaging/plugin-config.xml");

Review Comment:
   This file is missing in PR



##########
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:
   instead of `getExtension(file)` we can use `artifactType.getExtension()` as 
improvements



-- 
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-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to