Skip to content

Commit

Permalink
Add override ability
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Aug 14, 2024
1 parent acbd484 commit 87ce4fd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public class DeployFileMojo extends AbstractDeployMojo {
@Parameter(property = "packaging")
private String packaging;

/**
* Extension of the artifact to be deployed. If set, will override plugin own logic to detect extension. If not set,
* as Maven expected, packaging determines the artifact extension.
*
* @since 3.1.3
*/
@Parameter(property = "extension")
private String extension;

/**
* Description passed to a generated POM file (in case of generatePom=true)
*/
Expand Down Expand Up @@ -280,8 +289,9 @@ public void execute() throws MojoExecutionException, MojoFailureException {
mainArtifactExtension = packaging;
}
}
Artifact mainArtifact =
new DefaultArtifact(groupId, artifactId, classifier, mainArtifactExtension, version).setFile(file);
Artifact mainArtifact = new DefaultArtifact(
groupId, artifactId, classifier, extension != null ? extension : mainArtifactExtension, version)
.setFile(file);
deployRequest.addArtifact(mainArtifact);

File artifactLocalFile = getLocalRepositoryFile(session.getRepositorySession(), mainArtifact);
Expand Down

0 comments on commit 87ce4fd

Please sign in to comment.