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 2003/12/27 05:25:26 UTC

cvs commit: maven-components/maven-project/src/java/org/apache/maven/artifact AbstractArtifact.java Artifact.java Artifactory.java DefaultArtifactFactory.java DefaultArtifactory.java GenericArtifact.java

jvanzyl     2003/12/26 20:25:26

  Added:       maven-project/src/java/org/apache/maven/artifact
                        AbstractArtifact.java Artifact.java
                        Artifactory.java DefaultArtifactFactory.java
                        DefaultArtifactory.java GenericArtifact.java
  Log:
  o I have taken the artifact processing wholus bolus from Maven 1.x to ensure
    compatibility in artifact processing.
  
    Michal: I tried to use maven-artifact-factory but only the tests were
    present :-) But I think this way might be better as some tests can be
    added and using the original Maven code we can be assured it's right for
    backward compatibility. Once we have some tests then we can simply make
    another Artifactory implementation, swap out the original and test it.
  
  Revision  Changes    Path
  1.1                  maven-components/maven-project/src/java/org/apache/maven/artifact/AbstractArtifact.java
  
  Index: AbstractArtifact.java
  ===================================================================
  package org.apache.maven.artifact;
  
  /* ====================================================================
   * 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.model.Dependency;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.FileInputStream;
  
  /**
   * Base class from which all artifact subclasses are derived.
   *
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @version $Id: AbstractArtifact.java,v 1.1 2003/12/27 04:25:26 jvanzyl Exp $
   */
  public abstract class AbstractArtifact
      implements Artifact
  {
      /** Platform specific file separator used for file system operations. */
      protected static final String ps = File.separator;
  
      /** Dependency this artifact is based on. */
      private Dependency dependency;
  
      /** Path to artifact. */
      private String path;
  
      /**
       * Default constructor.
       * @param dependency the dependency the artifact is based on
       */
      public AbstractArtifact( Dependency dependency )
      {
          this.dependency = dependency;
      }
  
      /** @see Artifact#setDependency */
      public void setDependency( Dependency dependency )
      {
          this.dependency = dependency;
      }
  
      /** @see Artifact#getDependency */
      public Dependency getDependency()
      {
          return dependency;
      }
  
      /** @see Artifact#setPath */
      public void setPath( String path )
      {
          this.path = path;
      }
  
      /** @see Artifact#getPath */
      public String getPath()
      {
          if ( path == null )
          {
              return generatePath();
          }
  
          return path;
      }
  
      /** @see Artifact#generatePath */
      public String generatePath()
      {
          return "/" + getArtifactDirectory( getDependency() )
               + ps + getDependency().getType() + "s"
               + ps + getDependency().getArtifact();
      }
  
      /** @see Artifact#getUrlPath */
      public String getUrlPath()
      {
          return "/" + getArtifactDirectory( getDependency() )
               + "/" + getDependency().getType() + "s"
               + "/" + getDependency().getArtifact();
      }
  
      /** @see Artifact#getChecksumUrl */
      public String getChecksumUrl()
      {
          return "/" + getArtifactDirectory( getDependency() )
               + "/" + getDependency().getType() + "s"
               + "/" + getDependency().getArtifact()
               + ".md5";
      }
  
      /**
       * Get the directory to place the artifact in. If the groupId has been
       * set then use that, otherwise use the id.
       *
       * @return The artifact directory.
       */
      public String getArtifactDirectory( Dependency d )
      {
          if ( isValid( d.getGroupId() ) )
          {
              return d.getGroupId();
          }
  
          return d.getId();
      }
  
      protected boolean isValid( String value )
      {
          if (    value != null
               && value.trim().equals("") == false )
          {
              return true;
          }
  
          return false;
      }
  
      /**
       * Get the name of the artifact from the underlying dependency.
       *
       * @return The name of the underlying dependency.
       */
      public String getName()
      {
          return getDependency().getArtifact();
      }
  
      /** @see Artifact#exists */
      public boolean exists()
      {
          return getFile().exists();
      }
  
      /** @see Artifact#isSnapshot */
      public boolean isSnapshot()
      {
          return getDependency().getArtifact().indexOf( "SNAPSHOT" ) > 0;
      }
  
      /** @see Artifact#getFile */
      public File getFile()
      {
          return new File( getPath() );
      }
  
      /**
       * Reads the contents of a file.
       *
       * @param file The name of the file to read.
       * @return The file contents or null if read failed.
       * @throws IOException if there is an error reading the file
       */
      String fileRead( File file )
          throws IOException
      {
          StringBuffer buf = new StringBuffer();
  
          FileInputStream in = new FileInputStream( file );
  
          int count;
          byte[] b = new byte[512];
          while ( ( count = in.read( b ) ) > 0 )  // blocking read
          {
              buf.append( new String( b, 0, count ) );
          }
  
          in.close();
  
          return buf.toString();
      }
  }
  
  
  
  1.1                  maven-components/maven-project/src/java/org/apache/maven/artifact/Artifact.java
  
  Index: Artifact.java
  ===================================================================
  package org.apache.maven.artifact;
  
  /* ====================================================================
   * 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.model.Dependency;
  
  import java.io.File;
  
  /**
   * The interface defining an artifact (which probably lives in the
   * artifact).
   *
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @version $Id: Artifact.java,v 1.1 2003/12/27 04:25:26 jvanzyl Exp $
   */
  public interface Artifact
  {
       /**
       * Set the dependency for this JAR artifact.
       *
       * @param dependency Dependency this artifact is based on.
       */
      void setDependency( Dependency dependency );
  
      /**
       * Get the dependency.
       *
       * @return The dependency this artifact is based on.
       */
      Dependency getDependency();
  
      /**
       * Set the path to the artifact. The maven jar override facilty can be
       * used to change the path to the artifact if the user specifies the
       * use of a specific version.
       *
       * @param path Path to the artifact.
       */
      void setPath( String path );
  
      /**
       * Return the path of the artifact using platform specific naming
       * conventions.
       *
       * @return Path to the artifact.
       */
      String getPath();
  
      /**
       * Generate the path for this artifact given its dependency attributes.
       *
       * @return The generated path of the artifact based on the dependency attributes.
       */
      String generatePath();
  
      /**
       * Return an URL path that is platform agnostic.
       *
       * @return URL of the artifact.
       */
      String getUrlPath();
  
      /**
       * Return the url to the checksum file for this artifact.
       *
       * @return URL of the checksum file for this artifact.
       */
      String getChecksumUrl();
  
      /**
       * Return the name of the artifact.
       *
       * @return Name of the underlying dependency.
       */
      String getName();
  
      /**
       * Boolean flag indicating whether this artifact is a snapshot.
       *
       * @return Flag indicating whether this artifact is a snapshot.
       */
      boolean isSnapshot();
  
      /**
       * Boolean flag indicating whether this artifact exists.
       *
       * @return Flag indicating the existance of the artifact in the local artifact.
       */
      boolean exists();
  
      /**
       * Get the location of the artifact in the local file system.
       *
       * @return The location of the artifact in the local file system.
       */
      File getFile();
  }
  
  
  
  1.1                  maven-components/maven-project/src/java/org/apache/maven/artifact/Artifactory.java
  
  Index: Artifactory.java
  ===================================================================
  package org.apache.maven.artifact;
  
  import org.apache.maven.project.Project;
  
  import java.util.List;
  
  /**
   *
   * 
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   *
   * @version $Id: Artifactory.java,v 1.1 2003/12/27 04:25:26 jvanzyl Exp $
   */
  public interface Artifactory
  {
      static String ROLE = Artifactory.class.getName();
  
      List createArtifacts( Project project );
  }
  
  
  
  1.1                  maven-components/maven-project/src/java/org/apache/maven/artifact/DefaultArtifactFactory.java
  
  Index: DefaultArtifactFactory.java
  ===================================================================
  package org.apache.maven.artifact;
  
  import org.apache.maven.model.Dependency;
  
  /* ====================================================================
   * 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/>.
   *
   * ====================================================================
   */
  
  /**
   * Simple factory for creating Artifact implementations based on a dependency
   * type.
   *
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @version $Id: DefaultArtifactFactory.java,v 1.1 2003/12/27 04:25:26 jvanzyl Exp $
   *
   * @todo The factor needs to take a properties file describing the acceptable
   *       types of artifacts. We can have a default set and also allow users
   *       to customize the list for their own purposes.
   */
  public class DefaultArtifactFactory
  {
      /**
       * Return an appropriate Artifact implementation based on the dependency
       * type.
       *
       * @param dependency The base dependency.
       * @todo not the intended usage of test type
       * @return The appropriate artifact based on the dependency type.
       */
      public static Artifact createArtifact( Dependency dependency )
      {
          //!! I certainly have to revisit this. As sometimes we get
          // any of the following conditions satisfied.
          if (    dependency.getType() == null
               || dependency.getType().trim().length() == 0
               || dependency.getType().equals( "jar" )
               || dependency.getType().equals( "test" ) )
          {
              dependency.setType( "jar" );
              return new GenericArtifact( dependency );
          }
          else
          {
              return new GenericArtifact( dependency );
          }
      }
  }
  
  
  
  1.1                  maven-components/maven-project/src/java/org/apache/maven/artifact/DefaultArtifactory.java
  
  Index: DefaultArtifactory.java
  ===================================================================
  package org.apache.maven.artifact;
  
  /* ====================================================================
   * 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.project.Project;
  import org.apache.maven.artifact.Artifact;
  import org.apache.maven.artifact.DefaultArtifactFactory;
  import org.apache.maven.model.Dependency;
  import org.codehaus.plexus.util.StringUtils;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  /**
   *
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   *
   * @version $Id: DefaultArtifactory.java,v 1.1 2003/12/27 04:25:26 jvanzyl Exp $
   */
  public class DefaultArtifactory
      implements Artifactory
  {
      /**
       * Create the list of artifacts for a project based on the stated dependencies
       * taking into account any user specified overrides.
       *
       * @param project MavenSession project.
       * @return the list of artifacts for a project
       */
      public List createArtifacts( Project project  )
      {
          List projectArtifacts = new ArrayList();
  
          String mavenRepoLocal = project.getProperty( "maven.repo.local" );
  
          boolean mavenJarOverride = project.getBooleanProperty( "maven.jar.override" );
  
          for ( Iterator i = project.getDependencies().iterator(); i.hasNext(); )
          {
              Dependency d = (Dependency) i.next();
  
              String mavenJarProperty = project.getProperty( "maven.jar." + Project.standardToLegacyId( d.getId() ) );
  
              Artifact artifact = DefaultArtifactFactory.createArtifact( d );
  
              if ( mavenJarOverride && StringUtils.isNotEmpty(mavenJarProperty) )
              {
                  // 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.
                  if ( Character.isDigit( mavenJarProperty.charAt( 0 ) ) )
                  {
                      // User is requesting a specific version of a dependency
                      // be used.
                      d.setVersion( mavenJarProperty );
  
                      artifact.setPath( mavenRepoLocal + artifact.generatePath() );
                  }
                  else
                  {
                      // User is requesting a specific path to a dependency
                      // be used.
                      artifact.setPath( new File( mavenJarProperty ).getAbsolutePath() );
                  }
              }
              else
              {
                  artifact.setPath( mavenRepoLocal + artifact.generatePath() );
              }
  
              projectArtifacts.add( artifact );
          }
  
          return projectArtifacts;
      }
  }
  
  
  
  1.1                  maven-components/maven-project/src/java/org/apache/maven/artifact/GenericArtifact.java
  
  Index: GenericArtifact.java
  ===================================================================
  package org.apache.maven.artifact;
  
  import org.apache.maven.model.Dependency;
  
  /* ====================================================================
   * 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/>.
   *
   * ====================================================================
   */
  
  /**
   * Generic artifact that builds its path and url information based on its
   * associated dependency. URLs are of the form "id/type/artifact".
   *
   * @author <a href="mailto:jason@zenplex.org">Jason van Zyl</a>
   *
   * @version $Id: GenericArtifact.java,v 1.1 2003/12/27 04:25:26 jvanzyl Exp $
   */
  public class GenericArtifact
      extends AbstractArtifact
  {
      /**
       * Constructor for the GenericArtifact object
       *
       * @param dependency Project dependency.
       */
      public GenericArtifact( Dependency dependency )
      {
          super( dependency );
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: cvs commit: maven-components/maven-project/src/java/org/apache/maven/artifact AbstractArtifact.java Artifact.java Artifactory.java DefaultArtifactFactory.java DefaultArtifactory.java GenericArtifact.java

Posted by Stephen McConnell <mc...@apache.org>.

jvanzyl@apache.org wrote:

>  
>      /** @see Artifact#isSnapshot */
>      public boolean isSnapshot()
>      {
>          return getDependency().getArtifact().indexOf( "SNAPSHOT" ) > 0;
>      }
>

Is this really indexof or endsWith ?

Stephen.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org

|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/                               |
|------------------------------------------------|





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org