diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java b/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java index 54a322db3d..8819869223 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java @@ -71,8 +71,6 @@ public class DefaultArtifactInstaller String localPath = localRepository.pathOf( artifact ); - getLogger().info( "Installing " + source.getPath() + " to " + localPath ); - // TODO: use a file: wagon and the wagon manager? File destination = new File( localRepository.getBasedir(), localPath ); if ( !destination.getParentFile().exists() ) @@ -80,6 +78,8 @@ public class DefaultArtifactInstaller destination.getParentFile().mkdirs(); } + getLogger().info( "Installing " + source.getPath() + " to " + destination ); + FileUtils.copyFile( source, destination ); // must be after the artifact is installed 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 83091eb681..d2667403e5 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 @@ -89,16 +89,24 @@ public class DeployMojo // Deploy the POM Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), project.getPackaging() ); - if ( !"pom".equals( project.getPackaging() ) ) + boolean isPomArtifact = "pom".equals( project.getPackaging() ); + File pom = new File( project.getFile().getParentFile(), "pom.xml" ); + if ( !isPomArtifact ) { - File pom = new File( project.getFile().getParentFile(), "pom.xml" ); ArtifactMetadata metadata = new ModelMetadata( artifact, pom ); artifact.addMetadata( metadata ); } try { - deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository ); + if ( !isPomArtifact ) + { + deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository ); + } + else + { + deployer.deploy( pom, artifact, deploymentRepository, localRepository ); + } } catch ( ArtifactDeploymentException e ) { 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 caefcd50a5..f0af537627 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 @@ -68,16 +68,24 @@ public class InstallMojo Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), project.getPackaging() ); - if ( !"pom".equals( project.getPackaging() ) ) + boolean isPomArtifact = "pom".equals( project.getPackaging() ); + File pom = new File( project.getFile().getParentFile(), "pom.xml" ); + if ( !isPomArtifact ) { - File pom = new File( project.getFile().getParentFile(), "pom.xml" ); ArtifactMetadata metadata = new ModelMetadata( artifact, pom ); artifact.addMetadata( metadata ); } try { - installer.install( project.getBuild().getDirectory(), artifact, localRepository ); + if ( !isPomArtifact ) + { + installer.install( project.getBuild().getDirectory(), artifact, localRepository ); + } + else + { + installer.install( pom, artifact, localRepository ); + } } catch ( ArtifactInstallationException e ) {