jvanzyl 2002/12/08 22:00:23
Modified: src/java/org/apache/maven/verifier DependencyVerifier.java
Log:
refactoring
Revision Changes Path
1.5 +10 -15
jakarta-turbine-maven/src/java/org/apache/maven/verifier/DependencyVerifier.java
Index: DependencyVerifier.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/verifier/DependencyVerifier.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DependencyVerifier.java 8 Dec 2002 20:36:13 -0000 1.4
+++ DependencyVerifier.java 9 Dec 2002 06:00:23 -0000 1.5
@@ -60,9 +60,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.AbstractMavenComponent;
-import org.apache.maven.project.Dependency;
+import org.apache.maven.ArtifactListBuilder;
import org.apache.maven.repository.Artifact;
-import org.apache.maven.repository.DefaultArtifactFactory;
import org.apache.maven.util.HttpUtils;
import java.io.File;
@@ -155,15 +154,13 @@
}
clearFailedDependencies();
+ List projectArtifacts = ArtifactListBuilder.build(
getContext().getProject(), getContext() );
- File mavenRepoLocal = new File( getContext().getMavenRepoLocal() );
-
- for ( Iterator i = getContext().getProject().getDependencies().iterator();
i.hasNext(); )
+ for ( Iterator i = projectArtifacts.iterator(); i.hasNext(); )
{
- Dependency dependency = (Dependency) i.next();
- Artifact artifact = DefaultArtifactFactory.createArtifact( dependency );
+ Artifact artifact = (Artifact) i.next();
- if ( artifact.exists( mavenRepoLocal ) == false )
+ if ( artifact.exists() == false )
{
failedDependencies.add( artifact );
}
@@ -224,21 +221,19 @@
{
for ( Iterator i = failedDependencies.iterator(); i.hasNext(); )
{
- File mavenRepoLocal = new File( getContext().getMavenRepoLocal() );
Artifact artifact = (Artifact) i.next();
- File destinationFile = new File( mavenRepoLocal , artifact.getPath() );
- String artifactName = artifact.getName();
// The directory structure for the project this dependency belongs to
// may not exists so attempt to create the project directory structure
// before attempting to download the dependency.
- File directory = artifact.getFile( mavenRepoLocal ).getParentFile();
+ File directory = artifact.getFile().getParentFile();
+
if ( directory.exists() == false )
{
directory.mkdirs();
}
- if ( getRemoteFile( artifact.getUrlPath(), destinationFile ) )
+ if ( getRemoteFile( artifact.getUrlPath(), artifact.getFile() ) )
{
// The dependency has been successfully downloaded so lets remove
// it from the failed dependency list.
@@ -246,7 +241,7 @@
}
else
{
- String warning = getMessage( "failed.download.warning",
artifactName );
+ String warning = getMessage( "failed.download.warning",
artifact.getName() );
System.err.println( warning );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>