diff --git a/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java b/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java index 08e363467b..f2f60d249a 100644 --- a/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java +++ b/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java @@ -139,7 +139,12 @@ public class DeployMojo } else { - File file = new File( buildDirectory, finalName + "." + artifact.getArtifactHandler().getExtension() ); + File file = artifact.getFile(); + if ( file == null ) + { + throw new MojoExecutionException( + "The packaging for this project did not assign a file to the build artifact" ); + } deployer.deploy( file, artifact, deploymentRepository, localRepository ); } diff --git a/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java b/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java index 56ea438bc9..4bcb01e154 100644 --- a/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java +++ b/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java @@ -108,7 +108,12 @@ public class InstallMojo } else { - File file = new File( buildDirectory, finalName + "." + artifact.getArtifactHandler().getExtension() ); + File file = artifact.getFile(); + if ( file == null ) + { + throw new MojoExecutionException( + "The packaging for this project did not assign a file to the build artifact" ); + } installer.install( file, artifact, localRepository ); }