Resolving MNG-851. Using MavenProject.getFile() rather than constructing new. Also fixed maven-deploy-plugin with similar bug.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@280405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-09-12 20:08:01 +00:00
parent db945f1dd0
commit 459737fa5f
8 changed files with 21 additions and 10 deletions

View File

@ -185,6 +185,8 @@ it0064: Test the use of a mojo that uses setters instead of private fields
it0065: Test that the basedir of the parent is set correctly. it0065: Test that the basedir of the parent is set correctly.
it0066: Test that nonstandard POM files will be installed correctly.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
- generated sources - generated sources

View File

@ -1,3 +1,4 @@
it0066
it0065 it0065
it0064 it0064
it0063 it0063

View File

@ -0,0 +1 @@
-f other-pom.xml

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
install

View File

@ -0,0 +1,7 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-it0066</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
</project>

View File

@ -57,11 +57,11 @@ public class DeployMojo
private String packaging; private String packaging;
/** /**
* @parameter expression="${project.file.parentFile}" * @parameter expression="${project.file}"
* @required * @required
* @readonly * @readonly
*/ */
private File parentDir; private File pomFile;
/** /**
* @parameter expression="${project.build.directory}" * @parameter expression="${project.build.directory}"
@ -120,10 +120,9 @@ public class DeployMojo
// Deploy the POM // Deploy the POM
boolean isPomArtifact = "pom".equals( packaging ); boolean isPomArtifact = "pom".equals( packaging );
File pom = new File( parentDir, "pom.xml" );
if ( !isPomArtifact ) if ( !isPomArtifact )
{ {
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom ); ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
artifact.addMetadata( metadata ); artifact.addMetadata( metadata );
} }
@ -136,7 +135,7 @@ public class DeployMojo
{ {
if ( isPomArtifact ) if ( isPomArtifact )
{ {
deployer.deploy( pom, artifact, deploymentRepository, localRepository ); deployer.deploy( pomFile, artifact, deploymentRepository, localRepository );
} }
else else
{ {

View File

@ -45,11 +45,11 @@ public class InstallMojo
protected String packaging; protected String packaging;
/** /**
* @parameter expression="${basedir}" * @parameter expression="${project.file}"
* @required * @required
* @readonly * @readonly
*/ */
private File basedir; private File pomFile;
/** /**
* @parameter expression="${project.build.directory}" * @parameter expression="${project.build.directory}"
@ -89,10 +89,9 @@ public class InstallMojo
// TODO: push into transformation // TODO: push into transformation
boolean isPomArtifact = "pom".equals( packaging ); boolean isPomArtifact = "pom".equals( packaging );
File pom = new File( basedir, "pom.xml" );
if ( !isPomArtifact ) if ( !isPomArtifact )
{ {
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom ); ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
artifact.addMetadata( metadata ); artifact.addMetadata( metadata );
} }
@ -105,7 +104,7 @@ public class InstallMojo
{ {
if ( isPomArtifact ) if ( isPomArtifact )
{ {
installer.install( pom, artifact, localRepository ); installer.install( pomFile, artifact, localRepository );
} }
else else
{ {