fix deploy/install os standalone POMs

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163688 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-24 11:57:47 +00:00
parent e697f5bd8c
commit b9de151229
3 changed files with 24 additions and 8 deletions

View File

@ -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

View File

@ -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 )
{

View File

@ -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 )
{