maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/verifier ProjectVerifier.java
Date Tue, 03 Dec 2002 06:33:47 GMT
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();
  
  
  

Mime
View raw message