mirror of https://github.com/apache/maven.git
[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
This commit is contained in:
parent
87b687615b
commit
2ce2f9bf2a
|
@ -2031,35 +2031,38 @@ public class MavenProject
|
||||||
private void addArtifactPath( Artifact a, List<String> list )
|
private void addArtifactPath( Artifact a, List<String> list )
|
||||||
throws DependencyResolutionRequiredException
|
throws DependencyResolutionRequiredException
|
||||||
{
|
{
|
||||||
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
|
File file = a.getFile();
|
||||||
MavenProject project = (MavenProject) projectReferences.get( refId );
|
if ( file != null )
|
||||||
|
|
||||||
boolean projectDirFound = false;
|
|
||||||
if ( project != 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 ( "test-jar".equals( a.getType() ) )
|
||||||
if ( testOutputDir.exists() )
|
|
||||||
{
|
{
|
||||||
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;
|
projectDirFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
if ( !projectDirFound )
|
||||||
{
|
|
||||||
list.add( project.getBuild().getOutputDirectory() );
|
|
||||||
projectDirFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !projectDirFound )
|
|
||||||
{
|
|
||||||
File file = a.getFile();
|
|
||||||
if ( file == null )
|
|
||||||
{
|
{
|
||||||
throw new DependencyResolutionRequiredException( a );
|
throw new DependencyResolutionRequiredException( a );
|
||||||
}
|
}
|
||||||
list.add( file.getPath() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue