Return-Path: Mailing-List: contact turbine-maven-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list turbine-maven-dev@jakarta.apache.org Received: (qmail 23908 invoked by uid 97); 3 Dec 2002 06:35:06 -0000 Received: (qmail 23904 invoked by uid 98); 3 Dec 2002 06:35:06 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 23866 invoked from network); 3 Dec 2002 06:35:04 -0000 Received: from daedalus.apache.org (HELO apache.org) (63.251.56.142) by nagoya.betaversion.org with SMTP; 3 Dec 2002 06:35:04 -0000 Received: (qmail 18225 invoked by uid 500); 3 Dec 2002 06:33:48 -0000 Received: (qmail 18218 invoked from network); 3 Dec 2002 06:33:48 -0000 Received: from icarus.apache.org (63.251.56.143) by daedalus.apache.org with SMTP; 3 Dec 2002 06:33:48 -0000 Received: (qmail 42109 invoked by uid 1162); 3 Dec 2002 06:33:47 -0000 Date: 3 Dec 2002 06:33:47 -0000 Message-ID: <20021203063347.42108.qmail@icarus.apache.org> From: jvanzyl@apache.org To: jakarta-turbine-maven-cvs@apache.org Subject: cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/verifier ProjectVerifier.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jvanzyl 2002/12/02 22:33:47 Modified: src/java/org/apache/maven/repository AbstractArtifact.java Artifact.java DefaultJarArtifact.java src/java/org/apache/maven/verifier ProjectVerifier.java Log: o making the project verifier work in a more general fashion w.r.t. dependencies. Pushing artifact specific knowledge into the artifact itself. Revision Changes Path 1.8 +15 -1 jakarta-turbine-maven/src/java/org/apache/maven/repository/AbstractArtifact.java Index: AbstractArtifact.java =================================================================== RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/AbstractArtifact.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- AbstractArtifact.java 25 Nov 2002 19:05:23 -0000 1.7 +++ AbstractArtifact.java 3 Dec 2002 06:33:47 -0000 1.8 @@ -1,5 +1,7 @@ package org.apache.maven.repository; +import java.io.File; + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -72,4 +74,16 @@ /** @see Artifact#getName */ public abstract String getName(); + + /** @see Artifact#exists */ + public boolean exists( File mavenRepoLocal ) + { + return getFile( mavenRepoLocal ).exists(); + } + + /** @see Artifact#getFile */ + public File getFile( File mavenRepoLocal ) + { + return new File( mavenRepoLocal, getPath() ); + } } 1.8 +20 -1 jakarta-turbine-maven/src/java/org/apache/maven/repository/Artifact.java Index: Artifact.java =================================================================== RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/Artifact.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Artifact.java 25 Nov 2002 19:05:23 -0000 1.7 +++ Artifact.java 3 Dec 2002 06:33:47 -0000 1.8 @@ -1,5 +1,7 @@ package org.apache.maven.repository; +import java.io.File; + /* ==================================================================== * The Apache Software License, Version 1.1 * @@ -86,4 +88,21 @@ * @return Name of the underlying dependency. */ String getName(); + + /** + * Boolean flag indicating whether this artifact exists in + * the local repository. + * + * @param mavenRepoLocal Maven local repository. + * @return Flag indicating the existance of the artifact in the local repository. + */ + boolean exists( File mavenRepoLocal ); + + /** + * Get the location of the artifact in the local repository. + * + * @param mavenRepoLocal The maven local repository. + * @return The location of the artifact in the local repository. + */ + File getFile( File mavenRepoLocal ); } 1.9 +20 -1 jakarta-turbine-maven/src/java/org/apache/maven/repository/DefaultJarArtifact.java Index: DefaultJarArtifact.java =================================================================== RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/DefaultJarArtifact.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- DefaultJarArtifact.java 25 Nov 2002 19:20:49 -0000 1.8 +++ DefaultJarArtifact.java 3 Dec 2002 06:33:47 -0000 1.9 @@ -59,6 +59,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.project.Dependency; +import org.apache.maven.MavenConstants; import java.io.File; @@ -139,5 +140,23 @@ public String getName() { return dependency.getArtifact(); + } + + /** @see Artifact#exists */ + public boolean exists( File mavenRepoLocal ) + { + String path = getPath(); + File jarFile = new File( mavenRepoLocal, path ); + + if ( jarFile.exists() == false + || + getDependency().getJar().endsWith( MavenConstants.SNAPSHOT_JAR_SIGNIFIER ) ) + { + return false; + } + else + { + return true; + } } } 1.9 +9 -10 jakarta-turbine-maven/src/java/org/apache/maven/verifier/ProjectVerifier.java Index: ProjectVerifier.java =================================================================== RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/verifier/ProjectVerifier.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ProjectVerifier.java 3 Dec 2002 02:56:22 -0000 1.8 +++ ProjectVerifier.java 3 Dec 2002 06:33:47 -0000 1.9 @@ -175,7 +175,10 @@ */ private void clearFailedDependencies() { - failedDependencies.clear(); + for ( int i = 0; i < failedDependencies.size(); i++ ) + { + failedDependencies.remove( i ); + } } /** @@ -195,23 +198,19 @@ clearFailedDependencies(); + File mavenRepoLocal = new File ( getContext().getMavenRepoLocal() ); + for ( Iterator i = getContext().getProject().getDependencies().iterator(); i.hasNext(); ) { Dependency dependency = (Dependency) i.next(); - String jar = dependency.getJar(); Artifact artifact = DefaultArtifactFactory.createArtifact( dependency ); - String path = artifact.getPath(); - File jarFile = new File( getContext().getMavenRepoLocal(), path ); - // So we want to pull down the checksum as well the first time - // the resource is pulled down to make sure that everything - // is cool. - if ( jarFile.exists() == false || jar.endsWith( MavenConstants.SNAPSHOT_JAR_SIGNIFIER ) ) + if ( artifact.exists( mavenRepoLocal) == false ) { // The directory structure for this project may // not exists so create it if missing. - File directory = jarFile.getParentFile(); + File directory = artifact.getFile( mavenRepoLocal ).getParentFile(); if ( directory.exists() == false ) { directory.mkdirs();