You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/04/20 18:44:36 UTC

cvs commit: maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/installer ArtifactInstallerTest.java

brett       2005/04/20 09:44:36

  Modified:    maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant
                        DeployTask.java InstallTask.java
               maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy
                        DeployMojo.java
               maven-plugins/maven-deploy-plugin pom.xml
               maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install
                        InstallMojo.java
               maven-artifact/src/main/java/org/apache/maven/artifact/deployer
                        ArtifactDeployer.java DefaultArtifactDeployer.java
               maven-artifact/src/main/java/org/apache/maven/artifact/handler
                        AbstractArtifactHandler.java ArtifactHandler.java
                        JavadocHandler.java SourceHandler.java
               maven-artifact/src/main/java/org/apache/maven/artifact/installer
                        ArtifactInstaller.java
                        DefaultArtifactInstaller.java
               maven-artifact/src/test/java/org/apache/maven/artifact/deployer
                        ArtifactDeployerTest.java
               maven-artifact/src/test/java/org/apache/maven/artifact/installer
                        ArtifactInstallerTest.java
  Log:
  correct problem where anything with a modified finalName was not installed/deployed
  
  Revision  Changes    Path
  1.3       +2 -2      maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java
  
  Index: DeployTask.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeployTask.java	18 Apr 2005 07:09:16 -0000	1.2
  +++ DeployTask.java	20 Apr 2005 16:44:35 -0000	1.3
  @@ -68,7 +68,7 @@
           {
               if ( !isPomArtifact )
               {
  -                deployer.deploy( pom.getBuild().getDirectory(), artifact, deploymentRepository, localRepo );
  +                deployer.deploy( file, artifact, deploymentRepository, localRepo );
               }
               else
               {
  
  
  
  1.2       +2 -2      maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java
  
  Index: InstallTask.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InstallTask.java	18 Apr 2005 04:12:35 -0000	1.1
  +++ InstallTask.java	20 Apr 2005 16:44:35 -0000	1.2
  @@ -64,7 +64,7 @@
           {
               if ( !isPomArtifact )
               {
  -                installer.install( pom.getBuild().getDirectory(), artifact, localRepo );
  +                installer.install( file, artifact, localRepo );
               }
               else
               {
  
  
  
  1.11      +3 -9      maven-components/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
  
  Index: DeployMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DeployMojo.java	6 Apr 2005 07:06:20 -0000	1.10
  +++ DeployMojo.java	20 Apr 2005 16:44:36 -0000	1.11
  @@ -80,13 +80,6 @@
               throw new PluginExecutionException( msg );
           }
   
  -        // TODO: put into the deployer
  -        if ( deploymentRepository.getAuthenticationInfo() == null )
  -        {
  -            getLog().warn( "Deployment repository {id: \'" + deploymentRepository.getId() +
  -                           "\'} has no associated authentication info!" );
  -        }
  -
           // Deploy the POM
           Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
                                                    project.getPackaging() );
  @@ -102,7 +95,8 @@
           {
               if ( !isPomArtifact )
               {
  -                deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository );
  +                deployer.deploy( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact,
  +                                 deploymentRepository, localRepository );
               }
               else
               {
  
  
  
  1.14      +3 -3      maven-components/maven-plugins/maven-deploy-plugin/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-deploy-plugin/pom.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- pom.xml	13 Apr 2005 05:11:49 -0000	1.13
  +++ pom.xml	20 Apr 2005 16:44:36 -0000	1.14
  @@ -19,18 +19,18 @@
       <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-artifact</artifactId>
  -      <version>2.0-alpha-1</version>
  +      <version>2.0-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.maven.wagon</groupId>
         <artifactId>wagon-file</artifactId>
  -      <version>1.0-alpha-2</version>
  +      <version>1.0-alpha-3-SNAPSHOT</version>
         <scope>runtime</scope>
       </dependency>
       <dependency>
         <groupId>org.apache.maven.wagon</groupId>
         <artifactId>wagon-ssh</artifactId>
  -      <version>1.0-alpha-2</version>
  +      <version>1.0-alpha-3-SNAPSHOT</version>
         <scope>runtime</scope>
       </dependency>
     </dependencies>
  
  
  
  1.15      +4 -2      maven-components/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
  
  Index: InstallMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- InstallMojo.java	24 Mar 2005 12:22:04 -0000	1.14
  +++ InstallMojo.java	20 Apr 2005 16:44:36 -0000	1.15
  @@ -80,7 +80,9 @@
           {
               if ( !isPomArtifact )
               {
  -                installer.install( project.getBuild().getDirectory(), artifact, localRepository );
  +                // TODO: would be something nice to get back from the project to get the full filename (the OGNL feedback thing)
  +                installer.install( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact,
  +                                   localRepository );
               }
               else
               {
  
  
  
  1.5       +1 -1      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java
  
  Index: ArtifactDeployer.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArtifactDeployer.java	24 Mar 2005 08:45:36 -0000	1.4
  +++ ArtifactDeployer.java	20 Apr 2005 16:44:36 -0000	1.5
  @@ -25,7 +25,7 @@
   {
       String ROLE = ArtifactDeployer.class.getName();
   
  -    void deploy( String basedir, Artifact artifact, ArtifactRepository deploymentRepository,
  +    void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository,
                    ArtifactRepository localRepository )
           throws ArtifactDeploymentException;
   
  
  
  
  1.9       +11 -2     maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
  
  Index: DefaultArtifactDeployer.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultArtifactDeployer.java	12 Apr 2005 06:14:52 -0000	1.8
  +++ DefaultArtifactDeployer.java	20 Apr 2005 16:44:36 -0000	1.9
  @@ -26,6 +26,7 @@
   import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
   import org.apache.maven.artifact.transform.ArtifactTransformation;
   import org.apache.maven.wagon.TransferFailedException;
  +import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.util.FileUtils;
   
   import java.io.File;
  @@ -34,6 +35,7 @@
   import java.util.List;
   
   public class DefaultArtifactDeployer
  +    extends AbstractLogEnabled
       implements ArtifactDeployer
   {
       private WagonManager wagonManager;
  @@ -42,7 +44,7 @@
   
       private List artifactTransformations;
   
  -    public void deploy( String basedir, Artifact artifact, ArtifactRepository deploymentRepository,
  +    public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository,
                           ArtifactRepository localRepository )
           throws ArtifactDeploymentException
       {
  @@ -50,7 +52,8 @@
   
           try
           {
  -            source = artifactHandlerManager.getArtifactHandler( artifact.getType() ).source( basedir, artifact );
  +            String extension = artifactHandlerManager.getArtifactHandler( artifact.getType() ).extension();
  +            source = new File( basedir, finalName + "." + extension );
           }
           catch ( ArtifactHandlerNotFoundException e )
           {
  @@ -64,6 +67,12 @@
                           ArtifactRepository localRepository )
           throws ArtifactDeploymentException
       {
  +        if ( deploymentRepository.getAuthenticationInfo() == null )
  +        {
  +            getLogger().warn( "Deployment repository {id: \'" + deploymentRepository.getId() +
  +                           "\'} has no associated authentication info!" );
  +        }
  +
           try
           {
               // TODO: better to have a transform manager, or reuse the handler manager again so we don't have these requirements duplicated all over?
  
  
  
  1.4       +1 -10     maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/AbstractArtifactHandler.java
  
  Index: AbstractArtifactHandler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/AbstractArtifactHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractArtifactHandler.java	1 Mar 2005 04:35:53 -0000	1.3
  +++ AbstractArtifactHandler.java	20 Apr 2005 16:44:36 -0000	1.4
  @@ -16,10 +16,6 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.artifact.Artifact;
  -
  -import java.io.File;
  -
   /**
    * @todo these should be configurable
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -33,11 +29,6 @@
           return null;
       }
   
  -    public File source( String basedir, Artifact artifact )
  -    {
  -        return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + extension() );
  -    }
  -
       public String extension()
       {
           return "jar";
  
  
  
  1.4       +1 -7      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
  
  Index: ArtifactHandler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArtifactHandler.java	23 Mar 2005 03:40:12 -0000	1.3
  +++ ArtifactHandler.java	20 Apr 2005 16:44:36 -0000	1.4
  @@ -16,10 +16,6 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.artifact.Artifact;
  -
  -import java.io.File;
  -
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
  @@ -28,8 +24,6 @@
   {
       static String ROLE = ArtifactHandler.class.getName();
   
  -    File source( String basedir, Artifact artifact );
  -
       String extension();
   
       String directory();
  
  
  
  1.4       +1 -9      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/JavadocHandler.java
  
  Index: JavadocHandler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/JavadocHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavadocHandler.java	23 Mar 2005 03:40:12 -0000	1.3
  +++ JavadocHandler.java	20 Apr 2005 16:44:36 -0000	1.4
  @@ -16,10 +16,6 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.artifact.Artifact;
  -
  -import java.io.File;
  -
   /**
    * @author <a href="mailto:carlos@apache.org">Carlos Sanchez </a>
    * @version $Id$
  @@ -27,10 +23,6 @@
   public class JavadocHandler
       extends AbstractArtifactHandler
   {
  -    public File source( String basedir, Artifact artifact )
  -    {
  -        return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "-javadocs." + extension() );
  -    }
   
       public String extension()
       {
  
  
  
  1.4       +1 -9      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/SourceHandler.java
  
  Index: SourceHandler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/handler/SourceHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceHandler.java	23 Mar 2005 03:40:12 -0000	1.3
  +++ SourceHandler.java	20 Apr 2005 16:44:36 -0000	1.4
  @@ -16,10 +16,6 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.artifact.Artifact;
  -
  -import java.io.File;
  -
   /**
    * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
    * @version $Id$
  @@ -27,10 +23,6 @@
   public class SourceHandler
       extends AbstractArtifactHandler
   {
  -    public File source( String basedir, Artifact artifact )
  -    {
  -        return new File( basedir, artifact.getArtifactId() + "-" + artifact.getVersion() + "-sources." + extension() );
  -    }
   
       public String extension()
       {
  
  
  
  1.7       +3 -2      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java
  
  Index: ArtifactInstaller.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ArtifactInstaller.java	29 Mar 2005 15:44:27 -0000	1.6
  +++ ArtifactInstaller.java	20 Apr 2005 16:44:36 -0000	1.7
  @@ -34,11 +34,12 @@
        * of the source file.
        *
        * @param basedir         the directory where the artifact is stored
  +     * @param finalName       the name of the artifact sans extension
        * @param artifact        the artifact definition
        * @param localRepository the local repository to install into
        * @throws ArtifactInstallationException if an error occurred installing the artifact
        */
  -    void install( String basedir, Artifact artifact, ArtifactRepository localRepository )
  +    void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository )
           throws ArtifactInstallationException;
   
   
  
  
  
  1.15      +3 -2      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
  
  Index: DefaultArtifactInstaller.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultArtifactInstaller.java	29 Mar 2005 16:41:13 -0000	1.14
  +++ DefaultArtifactInstaller.java	20 Apr 2005 16:44:36 -0000	1.15
  @@ -40,14 +40,15 @@
   
       private List artifactTransformations;
   
  -    public void install( String basedir, Artifact artifact, ArtifactRepository localRepository )
  +    public void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository )
           throws ArtifactInstallationException
       {
           File source = null;
   
           try
           {
  -            source = artifactHandlerManager.getArtifactHandler( artifact.getType() ).source( basedir, artifact );
  +            String extension = artifactHandlerManager.getArtifactHandler( artifact.getType() ).extension();
  +            source = new File( basedir, finalName + "." + extension );
           }
           catch ( ArtifactHandlerNotFoundException e )
           {
  
  
  
  1.4       +2 -2      maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java
  
  Index: ArtifactDeployerTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArtifactDeployerTest.java	24 Mar 2005 08:45:37 -0000	1.3
  +++ ArtifactDeployerTest.java	20 Apr 2005 16:44:36 -0000	1.4
  @@ -50,7 +50,7 @@
   
           Artifact artifact = createArtifact( "artifact", "1.0" );
   
  -        artifactDeployer.deploy( artifactBasedir, artifact, remoteRepository(), localRepository() );
  +        artifactDeployer.deploy( artifactBasedir, "artifact-1.0", artifact, remoteRepository(), localRepository() );
   
           assertRemoteArtifactPresent( artifact );
       }
  
  
  
  1.4       +2 -2      maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java
  
  Index: ArtifactInstallerTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArtifactInstallerTest.java	1 Mar 2005 06:20:30 -0000	1.3
  +++ ArtifactInstallerTest.java	20 Apr 2005 16:44:36 -0000	1.4
  @@ -50,7 +50,7 @@
   
           Artifact artifact = createArtifact( "artifact", "1.0" );
   
  -        artifactInstaller.install( artifactBasedir, artifact, localRepository() );
  +        artifactInstaller.install( artifactBasedir, "artifact-1.0", artifact, localRepository() );
   
           assertLocalArtifactPresent( artifact );
       }
  
  
  

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