You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by br...@apache.org on 2005/03/24 12:57:47 UTC

cvs commit: maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/installer DefaultArtifactInstaller.java

brett       2005/03/24 03:57:47

  Modified:    maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy
                        DeployMojo.java
               maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install
                        InstallMojo.java
               maven-artifact/src/main/java/org/apache/maven/artifact/installer
                        DefaultArtifactInstaller.java
  Log:
  fix deploy/install os standalone POMs
  
  Revision  Changes    Path
  1.8       +12 -4     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeployMojo.java	24 Mar 2005 10:30:58 -0000	1.7
  +++ DeployMojo.java	24 Mar 2005 11:57:47 -0000	1.8
  @@ -89,16 +89,24 @@
           // Deploy the POM
           Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
                                                    project.getPackaging() );
  -        if ( !"pom".equals( project.getPackaging() ) )
  +        boolean isPomArtifact = "pom".equals( project.getPackaging() );
  +        File pom = new File( project.getFile().getParentFile(), "pom.xml" );
  +        if ( !isPomArtifact )
           {
  -            File pom = new File( project.getFile().getParentFile(), "pom.xml" );
               ArtifactMetadata metadata = new ModelMetadata( artifact, pom );
               artifact.addMetadata( metadata );
           }
   
           try
           {
  -            deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository );
  +            if ( !isPomArtifact )
  +            {
  +                deployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository, localRepository );
  +            }
  +            else
  +            {
  +                deployer.deploy( pom, artifact, deploymentRepository, localRepository );
  +            }
           }
           catch ( ArtifactDeploymentException e )
           {
  
  
  
  1.13      +12 -4     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- InstallMojo.java	24 Mar 2005 10:30:58 -0000	1.12
  +++ InstallMojo.java	24 Mar 2005 11:57:47 -0000	1.13
  @@ -68,16 +68,24 @@
           Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
                                                    project.getPackaging() );
   
  -        if ( !"pom".equals( project.getPackaging() ) )
  +        boolean isPomArtifact = "pom".equals( project.getPackaging() );
  +        File pom = new File( project.getFile().getParentFile(), "pom.xml" );
  +        if ( !isPomArtifact )
           {
  -            File pom = new File( project.getFile().getParentFile(), "pom.xml" );
               ArtifactMetadata metadata = new ModelMetadata( artifact, pom );
               artifact.addMetadata( metadata );
           }
   
           try
           {
  -            installer.install( project.getBuild().getDirectory(), artifact, localRepository );
  +            if ( !isPomArtifact )
  +            {
  +                installer.install( project.getBuild().getDirectory(), artifact, localRepository );
  +            }
  +            else
  +            {
  +                installer.install( pom, artifact, localRepository );
  +            }
           }
           catch ( ArtifactInstallationException e )
           {
  
  
  
  1.13      +2 -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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultArtifactInstaller.java	24 Mar 2005 08:45:36 -0000	1.12
  +++ DefaultArtifactInstaller.java	24 Mar 2005 11:57:47 -0000	1.13
  @@ -71,8 +71,6 @@
   
               String localPath = localRepository.pathOf( artifact );
   
  -            getLogger().info( "Installing " + source.getPath() + " to " + localPath );
  -
               // TODO: use a file: wagon and the wagon manager?
               File destination = new File( localRepository.getBasedir(), localPath );
               if ( !destination.getParentFile().exists() )
  @@ -80,6 +78,8 @@
                   destination.getParentFile().mkdirs();
               }
   
  +            getLogger().info( "Installing " + source.getPath() + " to " + destination );
  +
               FileUtils.copyFile( source, destination );
   
               // must be after the artifact is installed