mirror of https://github.com/apache/maven.git
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:
parent
e697f5bd8c
commit
b9de151229
|
@ -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
|
||||
|
|
|
@ -89,17 +89,25 @@ 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 )
|
||||
{
|
||||
ArtifactMetadata metadata = new ModelMetadata( artifact, pom );
|
||||
artifact.addMetadata( metadata );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( !isPomArtifact )
|
||||
{
|
||||
deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository );
|
||||
}
|
||||
else
|
||||
{
|
||||
deployer.deploy( pom, artifact, deploymentRepository, localRepository );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactDeploymentException e )
|
||||
{
|
||||
// TODO: deployment exception that does not give a trace
|
||||
|
|
|
@ -68,17 +68,25 @@ 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 )
|
||||
{
|
||||
ArtifactMetadata metadata = new ModelMetadata( artifact, pom );
|
||||
artifact.addMetadata( metadata );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( !isPomArtifact )
|
||||
{
|
||||
installer.install( project.getBuild().getDirectory(), artifact, localRepository );
|
||||
}
|
||||
else
|
||||
{
|
||||
installer.install( pom, artifact, localRepository );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactInstallationException e )
|
||||
{
|
||||
// TODO: install exception that does not give a trace
|
||||
|
|
Loading…
Reference in New Issue