From 2ce2f9bf2a0e03deef1f68c5ad7e3400a782721a Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 24 Feb 2009 22:38:35 +0000 Subject: [PATCH] [MNG-2720] Multiproject dependencies not accurate for project.compileClasspathElements when run from root project o Basically merged from r741841 but I opted to leave in the resolution from project directories since I am not sure whether this can safely be removed right now git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@747588 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/project/MavenProject.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java index 7de76a0690..6580439b42 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java @@ -2031,35 +2031,38 @@ public class MavenProject private void addArtifactPath( Artifact a, List list ) throws DependencyResolutionRequiredException { - String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() ); - MavenProject project = (MavenProject) projectReferences.get( refId ); - - boolean projectDirFound = false; - if ( project != null ) + File file = a.getFile(); + if ( file != null ) { - if ( a.getType().equals( "test-jar" ) ) + list.add( file.getPath() ); + } + else + { + String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() ); + MavenProject project = (MavenProject) projectReferences.get( refId ); + + boolean projectDirFound = false; + if ( project != null ) { - File testOutputDir = new File( project.getBuild().getTestOutputDirectory() ); - if ( testOutputDir.exists() ) + if ( "test-jar".equals( a.getType() ) ) { - list.add( testOutputDir.getAbsolutePath() ); + File testOutputDir = new File( project.getBuild().getTestOutputDirectory() ); + if ( testOutputDir.exists() ) + { + list.add( testOutputDir.getAbsolutePath() ); + projectDirFound = true; + } + } + else + { + list.add( project.getBuild().getOutputDirectory() ); projectDirFound = true; } } - else - { - list.add( project.getBuild().getOutputDirectory() ); - projectDirFound = true; - } - } - if ( !projectDirFound ) - { - File file = a.getFile(); - if ( file == null ) + if ( !projectDirFound ) { throw new DependencyResolutionRequiredException( a ); } - list.add( file.getPath() ); } }