Removed code duplication

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@421968 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2006-07-14 17:55:57 +00:00
parent 8927d09f1c
commit 23f64db797
1 changed files with 21 additions and 30 deletions

View File

@ -474,21 +474,7 @@ public class MavenProject
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) ||
Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
{
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject project = (MavenProject) projectReferences.get( refId );
if ( project != null )
{
list.add( project.getBuild().getOutputDirectory() );
}
else
{
File file = a.getFile();
if ( file == null )
{
throw new DependencyResolutionRequiredException( a );
}
list.add( file.getPath() );
}
addArtifactPath( a, list );
}
}
}
@ -745,21 +731,7 @@ public class MavenProject
// TODO: let the scope handler deal with this
if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
{
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject project = (MavenProject) projectReferences.get( refId );
if ( project != null )
{
list.add( project.getBuild().getOutputDirectory() );
}
else
{
File file = a.getFile();
if ( file == null )
{
throw new DependencyResolutionRequiredException( a );
}
list.add( file.getPath() );
}
addArtifactPath( a, list );
}
}
}
@ -1626,4 +1598,23 @@ public class MavenProject
}
return pluginArtifact;
}
private void addArtifactPath(Artifact a, List list) throws DependencyResolutionRequiredException
{
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject project = (MavenProject) projectReferences.get( refId );
if ( project != null )
{
list.add( project.getBuild().getOutputDirectory() );
}
else
{
File file = a.getFile();
if ( file == null )
{
throw new DependencyResolutionRequiredException( a );
}
list.add( file.getPath() );
}
}
}