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 );
|
String localPath = localRepository.pathOf( artifact );
|
||||||
|
|
||||||
getLogger().info( "Installing " + source.getPath() + " to " + localPath );
|
|
||||||
|
|
||||||
// TODO: use a file: wagon and the wagon manager?
|
// TODO: use a file: wagon and the wagon manager?
|
||||||
File destination = new File( localRepository.getBasedir(), localPath );
|
File destination = new File( localRepository.getBasedir(), localPath );
|
||||||
if ( !destination.getParentFile().exists() )
|
if ( !destination.getParentFile().exists() )
|
||||||
|
@ -80,6 +78,8 @@ public class DefaultArtifactInstaller
|
||||||
destination.getParentFile().mkdirs();
|
destination.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLogger().info( "Installing " + source.getPath() + " to " + destination );
|
||||||
|
|
||||||
FileUtils.copyFile( source, destination );
|
FileUtils.copyFile( source, destination );
|
||||||
|
|
||||||
// must be after the artifact is installed
|
// must be after the artifact is installed
|
||||||
|
|
|
@ -89,16 +89,24 @@ public class DeployMojo
|
||||||
// Deploy the POM
|
// Deploy the POM
|
||||||
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
||||||
project.getPackaging() );
|
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 );
|
ArtifactMetadata metadata = new ModelMetadata( artifact, pom );
|
||||||
artifact.addMetadata( metadata );
|
artifact.addMetadata( metadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
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 )
|
catch ( ArtifactDeploymentException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,16 +68,24 @@ public class InstallMojo
|
||||||
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
||||||
project.getPackaging() );
|
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 );
|
ArtifactMetadata metadata = new ModelMetadata( artifact, pom );
|
||||||
artifact.addMetadata( metadata );
|
artifact.addMetadata( metadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
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 )
|
catch ( ArtifactInstallationException e )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue