From c4782c4a38ac77ca4de12c7884809a150e9856c2 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Thu, 8 Jan 2009 11:12:11 +0000 Subject: [PATCH] Fix: 3944 - we can just use the existence of the project directory to determine whether it is in the build. This will be a contract of the setProjectDirectory method git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@732683 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/project/builder/PomClassicDomainModel.java | 7 ++++++- .../apache/maven/project/builder/PomConstructionTest.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java b/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java index 8265c11ed7..4b32ea430c 100644 --- a/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java +++ b/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java @@ -141,6 +141,11 @@ public final class PomClassicDomainModel this.parentFile = parentFile; } + /** + * This should only be set for projects that are in the build. Setting for poms in the repo may cause unstable behavior. + * + * @param projectDirectory + */ public void setProjectDirectory(File projectDirectory) { this.projectDirectory = projectDirectory; @@ -153,7 +158,7 @@ public final class PomClassicDomainModel public boolean isPomInBuild() { - return projectDirectory != null && new File(projectDirectory, "pom.xml").isFile(); + return projectDirectory != null; } /** diff --git a/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java b/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java index 0b1a1e0d92..03a7c4c942 100644 --- a/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java +++ b/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java @@ -410,7 +410,7 @@ public class PomConstructionTest new File( pom.getValue( "properties/siteOut" ).toString() ) ); } - /* FIXME: cf. MNG-3944 + /* FIXME: cf. MNG-3944*/ public void testInterpolationOfBasedirInPomWithUnusualName() throws Exception { @@ -418,7 +418,7 @@ public class PomConstructionTest assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/prop0" ).toString() ) ); assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/prop1" ).toString() ) ); } - //*/ + private PomArtifactResolver artifactResolver( String basedir ) {