You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2002/12/05 03:30:17 UTC

cvs commit: jakarta-turbine-maven/src/test/java/org/apache/maven/app ProjectVerifierTest.java

jvanzyl     2002/12/04 18:30:17

  Modified:    src/java/org/apache/maven Maven.java
               src/java/org/apache/maven/jelly MavenJellyContext.java
               src/java/org/apache/maven/plugin PluginManager.java
               src/test log4j.properties
               src/test/java/org/apache/maven/app ProjectVerifierTest.java
  Added:       src/java/org/apache/maven DependencyClasspathBuilder.java
               src/java/org/apache/maven/verifier DependencyVerifier.java
                        LocalRepositoryVerifier.java
                        UnsatisfiedDependencyException.java
  Removed:     src/java/org/apache/maven CreateDependencyClasspath.java
               src/java/org/apache/maven/verifier ProjectVerifier.java
  Log:
  o refactoring
  
  Revision  Changes    Path
  1.7       +5 -5      jakarta-turbine-maven/src/java/org/apache/maven/Maven.java
  
  Index: Maven.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/Maven.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Maven.java	2 Dec 2002 07:31:43 -0000	1.6
  +++ Maven.java	5 Dec 2002 02:30:16 -0000	1.7
  @@ -67,7 +67,7 @@
   import org.apache.maven.jelly.JellyPropsHandler;
   import org.apache.maven.jelly.JellyUtils;
   import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.verifier.ProjectVerifier;
  +import org.apache.maven.verifier.DependencyVerifier;
   import org.apache.tools.ant.DemuxOutputStream;
   
   import java.io.File;
  @@ -314,7 +314,7 @@
       {
           // Create the dependency classpath for this plugin so that the
           // values can be made available in the plugin.jelly script.
  -        CreateDependencyClasspath cdc = new CreateDependencyClasspath();
  +        DependencyClasspathBuilder cdc = new DependencyClasspathBuilder();
           cdc.setRefid( MavenConstants.DEPENDENCY_CLASSPATH );
           cdc.setContext( getContext() );
           cdc.execute();
  @@ -328,7 +328,7 @@
       private void initializeProjectVerifier()
           throws Exception
       {
  -        ProjectVerifier projectVerifier = new ProjectVerifier();
  +        DependencyVerifier projectVerifier = new DependencyVerifier();
           projectVerifier.setContext( getContext() );
           getContext().setProjectVerifier( projectVerifier );
       }
  @@ -351,7 +351,7 @@
       /**
        * Create project verifier.
        *
  -     * @return ProjectVerifier An initialized project verifier.
  +     * @return DependencyVerifier An initialized project verifier.
        * @throws Exception If an error occurs while creating the project verifier.
        */
   
  
  
  
  1.1                  jakarta-turbine-maven/src/java/org/apache/maven/DependencyClasspathBuilder.java
  
  Index: DependencyClasspathBuilder.java
  ===================================================================
  package org.apache.maven;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.maven.project.Dependency;
  import org.apache.maven.repository.Artifact;
  import org.apache.maven.repository.DefaultArtifactFactory;
  import org.apache.tools.ant.types.Path;
  
  import java.io.File;
  import java.util.Iterator;
  
  /**
   * Take a valid MavenJellyContext which contains references to the POM, ant
   * project, and all defined properties and create the dependency classpath based
   * on dependencies listed in the POM. We also push the individual paths of each
   * of the dependencies back into the POM so that they can later be referenced in
   * maven.xml files and plugin.jelly files.
   *
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
   *
   * @version $Id: DependencyClasspathBuilder.java,v 1.1 2002/12/05 02:30:16 jvanzyl Exp $
   */
  public class DependencyClasspathBuilder
      extends AbstractMavenComponent
  {
      // ------------------------------------------------------------
      // I N S T A N C E  M E M B E R S
      // ------------------------------------------------------------
  
      /** Log. */
      private static final Log log = LogFactory.getLog( DependencyClasspathBuilder.class );
  
      /** Reference id for the generated classpath. */
      private String refid;
  
      // --------------------------------------------------------------
      // A C C E S S O R S
      // --------------------------------------------------------------
  
      /**
       * Set the ref id.
       *
       * @param refid The reference id for the classpath.
       */
      public void setRefid( String refid )
      {
          this.refid = refid;
      }
  
      /**
       * Get the ref id for the classpath.
       *
       * @return String The reference id.
       */
      public String getRefid()
      {
          return refid;
      }
  
      // --------------------------------------------------------------
      // I M P L E M E N T A T I O N
      // --------------------------------------------------------------
  
      /**
       * Create the dependency classpath.
       *
       * @throws Exception If an error occurs while creating the classpath.
       */
      public void execute()
          throws Exception
      {
          try
          {
              boolean mavenJarOverride = getContext().getMavenJarOverride().booleanValue();
              String mavenRepoLocal = getContext().getMavenRepoLocal();
              Path classpath = new Path( getContext().getAntProject() );
  
              for ( Iterator i = getContext().getProject().getDependencies().iterator(); i.hasNext(); )
              {
                  Dependency d = (Dependency) i.next();
  
                  // Only add jar dependencies to the classpath
                  if ( !( d.isCompileType() || d.isTestType() || "jar".equals( d.getType() ) ) )
                  {
                      continue;
                  }
  
                  String mavenJarProperty = getContext().getMavenJarOverride( d.getId() );
                  Path path = new Path( getContext().getAntProject() );
  
                  if ( mavenJarOverride
                        &&
                       mavenJarProperty != null
                        &&
                       mavenJarProperty.length() > 0 )
                  {
                      // The jar override option has been set and we have a property
                      // for the this dependency so override the path with the user
                      // specified value.
                      path.setPath( new File( mavenJarProperty ).getAbsolutePath() );
                  }
                  else
                  {
                      Artifact artifact = DefaultArtifactFactory.createArtifact( d );
                      // Use the jar in the local repository.
                      path.setPath( mavenRepoLocal + artifact.getPath() );
                  }
  
                  classpath.append( path );
                  getContext().getProject().setDependencyPath( d.getId(), path.toString() );
              }
  
              if ( getRefid() != null )
              {
                  getContext().getAntProject().addReference( getRefid(), classpath );
              }
  
          }
          catch ( Exception e )
          {
              e.printStackTrace();
              throw e;
          }
      }
  }
  
  
  
  1.16      +5 -5      jakarta-turbine-maven/src/java/org/apache/maven/jelly/MavenJellyContext.java
  
  Index: MavenJellyContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/MavenJellyContext.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MavenJellyContext.java	4 Dec 2002 23:37:19 -0000	1.15
  +++ MavenJellyContext.java	5 Dec 2002 02:30:17 -0000	1.16
  @@ -68,7 +68,7 @@
   import org.apache.maven.jelly.tags.MavenJeezTagLibrary;
   import org.apache.maven.jelly.tags.project.MavenTagLibrary;
   import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.verifier.ProjectVerifier;
  +import org.apache.maven.verifier.DependencyVerifier;
   import org.apache.maven.project.Project;
   
   import java.io.File;
  @@ -372,7 +372,7 @@
        *
        * @param projectVerifier The project verifier.
        */
  -    public void setProjectVerifier( ProjectVerifier projectVerifier )
  +    public void setProjectVerifier( DependencyVerifier projectVerifier )
       {
           setVariable( MavenConstants.MAVEN_PROJECT_VERIFIER, projectVerifier );
       }
  @@ -382,9 +382,9 @@
        *
        * @return The project verifier.
        */
  -    public ProjectVerifier getProjectVerifier()
  +    public DependencyVerifier getProjectVerifier()
       {
  -        return (ProjectVerifier) getVariable( MavenConstants.MAVEN_PROJECT_VERIFIER );
  +        return (DependencyVerifier) getVariable( MavenConstants.MAVEN_PROJECT_VERIFIER );
       }
   
       /**
  
  
  
  1.11      +3 -4      jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PluginManager.java	4 Dec 2002 07:01:15 -0000	1.10
  +++ PluginManager.java	5 Dec 2002 02:30:17 -0000	1.11
  @@ -61,8 +61,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.maven.AbstractMavenComponent;
  -import org.apache.maven.CreateDependencyClasspath;
  -import org.apache.maven.MavenConstants;
  +import org.apache.maven.DependencyClasspathBuilder;
   import org.apache.maven.MavenUtils;
   import org.apache.maven.jelly.JellyUtils;
   import org.apache.maven.jelly.MavenJellyContext;
  @@ -955,7 +954,7 @@
   
           // Create the dependency classpath for this plugin so that the
           // values can be made available in the plugin.jelly script.
  -        CreateDependencyClasspath cdc = new CreateDependencyClasspath();
  +        DependencyClasspathBuilder cdc = new DependencyClasspathBuilder();
           cdc.setContext( pluginJellyContext );
           cdc.execute();
   
  
  
  
  1.1                  jakarta-turbine-maven/src/java/org/apache/maven/verifier/DependencyVerifier.java
  
  Index: DependencyVerifier.java
  ===================================================================
  package org.apache.maven.verifier;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.commons.lang.StringUtils;
  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.repository.Artifact;
  import org.apache.maven.repository.DefaultArtifactFactory;
  import org.apache.maven.util.HttpUtils;
  
  import java.io.File;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  /**
   * Make sure that everything that is required for the project to build
   * successfully is present. We will start by looking at the dependencies
   * and make sure they are all here before trying to compile.
   *
   * @author <a href="jason@zenplex.com">Jason van Zyl</a>
   * @author <a href="vmassol@apache.org">Vincent Massol</a>
   *
   * @version $Id: DependencyVerifier.java,v 1.1 2002/12/05 02:30:17 jvanzyl Exp $
   *
   * @todo Create a list of all things that could go wrong and then protect
   *       against them.
   * @todo Make the non-distributable list an XML file and use the
   *       the standard betwixt mechanism for reading it in.
   * @todo Move the general settings verification out of this class.
   * @todo Rename the remainder of this a dependency verifier as that's all
   *       it's doing and naming it otherwise is just misleading.
   */
  public class DependencyVerifier
      extends AbstractMavenComponent
  {
      /** Log. */
      private static final Log log = LogFactory.getLog( DependencyVerifier.class );
  
      /** Control the use of timestamp comparison when downloading missing resources. */
      private boolean useTimestamp = true;
  
      /** Control continuation upon errors during the downloading of missing resources. */
      private boolean ignoreErrors = true;
  
      /** Container for storing warnings about JARs that cannot be distributed by Maven. */
      private StringBuffer warnings = new StringBuffer();
  
      /** List of failed deps. */
      private List failedDependencies;
  
      /** Local Repository verifier. */
      private LocalRepositoryVerifier localRepositoryVerifier;
  
  
      /** Default ctor. */
      public DependencyVerifier()
      {
          failedDependencies = new ArrayList();
          localRepositoryVerifier = new LocalRepositoryVerifier();
      }
  
      /**
       * Execute the verification process.
       *
       * @throws Exception If an error occurs while verifying.
       */
      public void execute()
          throws Exception
      {
          localRepositoryVerifier.setContext( getContext() );
          localRepositoryVerifier.verifyLocalRepository();
          verifyDependencies();
      }
  
      /**
       * Clear the failed dependencies. Required when reusing the
       * project verifier.
       */
      private void clearFailedDependencies()
      {
          for ( int i = 0; i < failedDependencies.size(); i++ )
          {
              failedDependencies.remove( i );
          }
      }
  
      /**
       * Check to see that all dependencies are present and if they are
       * not then download them.
       * @throws Exception when an error occurs verifying
       */
      private void verifyDependencies()
          throws Exception
      {
          boolean remoteRepoEnabled = getContext().getRemoteRepositoryEnabled().booleanValue();
  
          if ( remoteRepoEnabled == false )
          {
              log.info( getMessage( "remote.repository.disabled.warning" ) );
          }
  
          clearFailedDependencies();
  
          File mavenRepoLocal = new File( getContext().getMavenRepoLocal() );
  
          for ( Iterator i = getContext().getProject().getDependencies().iterator(); i.hasNext(); )
          {
              Dependency dependency = (Dependency) i.next();
  
              Artifact artifact = DefaultArtifactFactory.createArtifact( dependency );
  
              if ( artifact.exists( mavenRepoLocal ) == false )
              {
                  // The directory structure for this project may
                  // not exists so create it if missing.
                  File directory = artifact.getFile( mavenRepoLocal ).getParentFile();
                  if ( directory.exists() == false )
                  {
                      directory.mkdirs();
                  }
  
                  failedDependencies.add( artifact );
              }
          }
  
          // If we have any failed dependencies then we will download
          // them for the user.
          if ( failedDependencies.size() > 0 )
          {
              getDependencies();
          }
  
          if ( warnings.length() > 1 )
          {
              log.info( "\n" + warnings.toString() );
          }
      }
  
      private void getDependencies()
      {
          for ( Iterator i = failedDependencies.iterator(); i.hasNext(); )
          {
              Artifact artifact = (Artifact) i.next();
              File destinationFile = new File( getContext().getMavenRepoLocal(), artifact.getPath() );
              String artifactName = artifact.getName();
  
              if ( getRemoteFile( artifact.getUrlPath(), destinationFile ) == false )
              {
                  warnings.append( getMessage( "failed.download.warning", artifactName ) ).append( "\n" );
              }
          }
      }
  
  
      /**
       * Retrieve a <code>remoteFile</code> from the maven remote repositories
       * and store it at <code>localFile</code>
       * @param remoteFile the file name to retrieve from the repositories
       * @param localFile the file name to store the remote file locally
       * @return true if the retrieval succeeds, false otherwise
       */
      private boolean getRemoteFile( String remoteFile, File localFile )
      {
          if ( getContext().getOnline().booleanValue() == false )
          {
              return false;
          }
  
          for ( Iterator i = getContext().getMavenRepoRemote().iterator(); i.hasNext(); )
          {
              String remoteRepo = (String) i.next();
  
              try
              {
                  // The username and password parameters are not being
                  // used here. Those are the "" parameters you see below.
                  String url = remoteRepo + "/" + remoteFile;
                  url = StringUtils.replace( url, "//", "/" );
                  url = StringUtils.replace( url, "http:/", "http://" );
                  boolean gotFile = HttpUtils.getFile( new URL( url ),
                                                       localFile,
                                                       url,
                                                       ignoreErrors,
                                                       useTimestamp,
                                                       "",
                                                       "",
                                                       getContext().getProxyHost(),
                                                       getContext().getProxyPort(),
                                                       getContext().getProxyUserName(),
                                                       getContext().getProxyPassword() );
                  if ( gotFile )
                  {
                      return true;
                  }
              }
              catch ( MalformedURLException mue )
              {
                  // do nothing.
              }
          }
  
          return false;
      }
  }
  
  
  
  1.1                  jakarta-turbine-maven/src/java/org/apache/maven/verifier/LocalRepositoryVerifier.java
  
  Index: LocalRepositoryVerifier.java
  ===================================================================
  package org.apache.maven.verifier;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.maven.AbstractMavenComponent;
  
  import java.io.File;
  
  /**
   * Verify the integrity of the local repository.
   *
   * @author <a href="jason@zenplex.com">Jason van Zyl</a>
   *
   * @version $Id: LocalRepositoryVerifier.java,v 1.1 2002/12/05 02:30:17 jvanzyl Exp $
   */
  public class LocalRepositoryVerifier
      extends AbstractMavenComponent
  {
      /** Default constructor. */
      public LocalRepositoryVerifier()
      {
      }
  
      /**
       * Verify user settings before attempting to verify the project.
       *
       * @throws Exception If an error occurs while trying to verify some basic
       * maven settings.
       */
      public void verifyLocalRepository()
          throws Exception
      {
          // Get local repo property.
          String localRepoProp = getContext().getMavenRepoLocal();
  
          if ( localRepoProp == null )
          {
              // This is not likely to happen any more as it defaults
              // to ${maven.home}/repository which is set in the driver.properties
              throw new RepoConfigException( getMessage( "maven.repo.local.unset" ) );
          }
  
          File localRepo = new File( localRepoProp );
  
          if ( localRepo.exists() == false )
          {
              System.err.println( getMessage( "directory.nonexistant.warning", localRepo ) );
  
              if ( localRepo.mkdirs() == false )
              {
                  throw new RepoConfigException( getMessage( "cannot.create.directory.warning", localRepo ) );
              }
          }
  
          if ( localRepo.isDirectory() == false )
          {
              throw new RepoConfigException( getMessage( "not.directory.warning", localRepo ) );
          }
  
          if ( localRepo.canWrite() == false )
          {
              throw new RepoConfigException( getMessage( "not.writable.warning", localRepo ) );
          }
      }
  }
  
  
  
  1.1                  jakarta-turbine-maven/src/java/org/apache/maven/verifier/UnsatisfiedDependencyException.java
  
  Index: UnsatisfiedDependencyException.java
  ===================================================================
  package org.apache.maven.verifier;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.maven.MavenException;
  
  /** Specialized unsatisfied dependency exception.
   *
   * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a>
   * @version $Id: UnsatisfiedDependencyException.java,v 1.1 2002/12/05 02:30:17 jvanzyl Exp $
   */
  public class UnsatisfiedDependencyException
      extends MavenException
  {
      /**
       * Constructs a UnsatisfiedDependencyException with the specified detail message.
       * @param message the detail message.
       */
      public UnsatisfiedDependencyException( String message )
      {
          super( message );
      }
  }
  
  
  
  1.6       +1 -1      jakarta-turbine-maven/src/test/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/test/log4j.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- log4j.properties	2 Dec 2002 01:17:50 -0000	1.5
  +++ log4j.properties	5 Dec 2002 02:30:17 -0000	1.6
  @@ -35,7 +35,7 @@
   # ------------------------------------------------------------------------
   # P R O J E C T  V E R I F I E R
   # ------------------------------------------------------------------------
  -log4j.category.org.apache.maven.verifier.ProjectVerifier = ${log.level}, verifier
  +log4j.category.org.apache.maven.verifier.DependencyVerifier = ${log.level}, verifier
   log4j.appender.verifier = org.apache.log4j.FileAppender
   log4j.appender.verifier.file = log.verifier
   log4j.appender.verifier.layout = org.apache.log4j.PatternLayout
  
  
  
  1.4       +3 -3      jakarta-turbine-maven/src/test/java/org/apache/maven/app/ProjectVerifierTest.java
  
  Index: ProjectVerifierTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/test/java/org/apache/maven/app/ProjectVerifierTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProjectVerifierTest.java	2 Dec 2002 01:17:51 -0000	1.3
  +++ ProjectVerifierTest.java	5 Dec 2002 02:30:17 -0000	1.4
  @@ -19,7 +19,7 @@
   // JUnitDoclet end extends_implements
   {
       // JUnitDoclet begin class
  -    org.apache.maven.verifier.ProjectVerifier projectverifier = null;
  +    org.apache.maven.verifier.DependencyVerifier projectverifier = null;
       // JUnitDoclet end class
   
       public ProjectVerifierTest( String name )
  @@ -29,10 +29,10 @@
           // JUnitDoclet end method ProjectVerifierTest
       }
   
  -    public org.apache.maven.verifier.ProjectVerifier createInstance() throws Exception
  +    public org.apache.maven.verifier.DependencyVerifier createInstance() throws Exception
       {
           // JUnitDoclet begin method testcase.createInstance
  -        return new org.apache.maven.verifier.ProjectVerifier();
  +        return new org.apache.maven.verifier.DependencyVerifier();
           // JUnitDoclet end method testcase.createInstance
       }