You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/07/28 14:27:10 UTC
svn commit: r798504 -
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
Author: bentmann
Date: Tue Jul 28 12:27:10 2009
New Revision: 798504
URL: http://svn.apache.org/viewvc?rev=798504&view=rev
Log:
o Cleaned up code
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java?rev=798504&r1=798503&r2=798504&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java Tue Jul 28 12:27:10 2009
@@ -584,24 +584,10 @@
{
if ( a.getArtifactHandler().isAddedToClasspath() )
{
- File file = a.getFile();
-
- if ( file == null )
- {
- throw new DependencyResolutionRequiredException( a );
- }
- list.add( file.getPath() );
+ addArtifactPath( a, list );
}
}
-
- /*
- System.out.println( "TEST CLASSPATH: ");
- for( String s : list )
- {
- System.out.println( ">>>>> " + s );
- }
- */
-
+
return list;
}
@@ -663,12 +649,7 @@
// TODO: let the scope handler deal with this
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
{
- File file = a.getFile();
- if ( file == null )
- {
- throw new DependencyResolutionRequiredException( a );
- }
- list.add( file.getPath() );
+ addArtifactPath( a, list );
}
}
}
@@ -1911,47 +1892,25 @@
}
}
- private void addArtifactPath( Artifact a, List<String> list )
+ private void addArtifactPath( Artifact artifact, List<String> classpath )
throws DependencyResolutionRequiredException
{
- File file = a.getFile();
- if ( file != null )
+ File file = artifact.getFile();
+ if ( file == null )
{
- list.add( file.getPath() );
+ throw new DependencyResolutionRequiredException( artifact );
}
else
{
- String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
- MavenProject project = projectReferences.get( refId );
-
- boolean projectDirFound = false;
- if ( project != null )
- {
- if ( "test-jar".equals( a.getType() ) )
- {
- File testOutputDir = new File( project.getBuild().getTestOutputDirectory() );
- if ( testOutputDir.exists() )
- {
- list.add( testOutputDir.getAbsolutePath() );
- projectDirFound = true;
- }
- }
- else
- {
- list.add( project.getBuild().getOutputDirectory() );
- projectDirFound = true;
- }
- }
- if ( !projectDirFound )
- {
- throw new DependencyResolutionRequiredException( a );
- }
+ classpath.add( file.getPath() );
}
}
private static String getProjectReferenceId( String groupId, String artifactId, String version )
{
- return groupId + ":" + artifactId + ":" + version;
+ StringBuilder buffer = new StringBuilder( 128 );
+ buffer.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( version );
+ return buffer.toString();
}
/**