From b9de1512290d097c31311028a86381c50953a8cd Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Thu, 24 Mar 2005 11:57:47 +0000 Subject: [PATCH] fix deploy/install os standalone POMs git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163688 13f79535-47bb-0310-9956-ffa450edef68 --- .../installer/DefaultArtifactInstaller.java | 4 ++-- .../org/apache/maven/plugin/deploy/DeployMojo.java | 14 +++++++++++--- .../apache/maven/plugin/install/InstallMojo.java | 14 +++++++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) 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 ) {