Return-Path: X-Original-To: apmail-maven-commits-archive@www.apache.org Delivered-To: apmail-maven-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89EF39909 for ; Thu, 1 Mar 2012 18:59:20 +0000 (UTC) Received: (qmail 55301 invoked by uid 500); 1 Mar 2012 18:59:20 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 55212 invoked by uid 500); 1 Mar 2012 18:59:20 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 55199 invoked by uid 99); 1 Mar 2012 18:59:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 18:59:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 18:59:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0D36B2388C42 for ; Thu, 1 Mar 2012 18:58:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r806929 [22/46] - in /websites/production/maventest/content/ant-tasks-2.1.3: ./ apidocs/ apidocs/org/ apidocs/org/apache/ apidocs/org/apache/maven/ apidocs/org/apache/maven/artifact/ apidocs/org/apache/maven/artifact/ant/ apidocs/org/apache... Date: Thu, 01 Mar 2012 18:57:47 -0000 To: commits@maven.apache.org From: hboutemy@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120301185800.0D36B2388C42@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DependenciesTask.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DependenciesTask.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DeployTask.html ============================================================================== --- websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DeployTask.html (added) +++ websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DeployTask.html Thu Mar 1 18:57:40 2012 @@ -0,0 +1,397 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.maven.artifact.ant.DeployTask
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
DeployTask
0%
0/61
0%
0/36
0
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.maven.artifact.ant;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.artifact.Artifact;
 23  
 import org.apache.maven.artifact.deployer.ArtifactDeployer;
 24  
 import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
 25  
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 26  
 import org.apache.maven.artifact.repository.ArtifactRepository;
 27  
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 28  
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 29  
 import org.apache.maven.model.DistributionManagement;
 30  
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
 31  
 import org.apache.tools.ant.BuildException;
 32  
 import org.apache.tools.ant.Project;
 33  
 
 34  
 /**
 35  
  * Deploy task, using maven-artifact.
 36  
  *
 37  
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
 38  
  * @version $Id$
 39  
  */
 40  0
 public class DeployTask
 41  
     extends InstallDeployTaskSupport
 42  
 {
 43  
     private RemoteRepository remoteRepository;
 44  
 
 45  
     private RemoteRepository remoteSnapshotRepository;
 46  
 
 47  0
     private boolean uniqueVersion = true;
 48  
 
 49  
     /**
 50  
      * Create a core-Maven deployment ArtifactRepository from a Maven Ant Tasks's RemoteRepository definition.
 51  
      * @param repository the remote repository as defined in Ant
 52  
      * @return the corresponding ArtifactRepository
 53  
      */
 54  
     protected ArtifactRepository createDeploymentArtifactRepository( RemoteRepository repository )
 55  
     {
 56  0
         if ( repository.getId().equals( repository.getUrl() ) )
 57  
         {
 58  
             // MANTTASKS-103: avoid default id set to the url, since it is used for maven-metadata-<id>.xml
 59  0
             repository.setId( "remote" );
 60  
         }
 61  
 
 62  0
         updateRepositoryWithSettings( repository );
 63  
 
 64  0
         ArtifactRepositoryLayout repositoryLayout =
 65  
             (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, repository.getLayout() );
 66  
 
 67  0
         ArtifactRepositoryFactory repositoryFactory = null;
 68  
 
 69  
         ArtifactRepository artifactRepository;
 70  
 
 71  
         try
 72  
         {
 73  0
             repositoryFactory = getArtifactRepositoryFactory( repository );
 74  
 
 75  0
             artifactRepository =
 76  
                 repositoryFactory.createDeploymentArtifactRepository( repository.getId(), repository.getUrl(),
 77  
                                                                       repositoryLayout, uniqueVersion );
 78  
         }
 79  
         finally
 80  
         {
 81  0
             releaseArtifactRepositoryFactory( repositoryFactory );
 82  0
         }
 83  
 
 84  0
         return artifactRepository;
 85  
     }
 86  
 
 87  
 
 88  
     protected void doExecute()
 89  
     {
 90  0
         if ( file == null && ( attachedArtifacts.size() == 0 ) )
 91  
         {
 92  0
             throw new BuildException( "You must specify a file and/or an attached artifact "
 93  
                 + "to deploy to the repository." );
 94  
         }
 95  
 
 96  0
         ArtifactRepository localRepo = createLocalArtifactRepository();
 97  
 
 98  0
         Pom pom = initializePom( localRepo );
 99  
 
 100  0
         if ( pom == null )
 101  
         {
 102  0
             throw new BuildException( "A POM element is required to deploy to the repository" );
 103  
         }
 104  
 
 105  0
         Artifact artifact = pom.getArtifact();
 106  
 
 107  
         // Deploy the POM
 108  0
         boolean isPomArtifact = "pom".equals( pom.getPackaging() );
 109  0
         if ( !isPomArtifact )
 110  
         {
 111  0
             ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom.getFile() );
 112  0
             artifact.addMetadata( metadata );
 113  
         }
 114  
 
 115  0
         ArtifactRepository deploymentRepository = getDeploymentRepository( pom, artifact );
 116  
 
 117  0
         log( "Deploying to " + deploymentRepository.getUrl(), Project.MSG_INFO );
 118  0
         ArtifactDeployer deployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE );
 119  
         try
 120  
         {
 121  0
             if ( file != null )
 122  
             {
 123  0
                 if ( !isPomArtifact )
 124  
                 {
 125  0
                     deployer.deploy( file, artifact, deploymentRepository, localRepo );
 126  
                 }
 127  
                 else
 128  
                 {
 129  0
                     deployer.deploy( pom.getFile(), artifact, deploymentRepository, localRepo );
 130  
                 }
 131  
             }
 132  
 
 133  
             // Deploy any attached artifacts
 134  0
             if ( attachedArtifacts != null )
 135  
             {
 136  0
                 for ( Artifact attachedArtifact : pom.getAttachedArtifacts() )
 137  
                 {
 138  0
                     deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository, localRepo );
 139  
                 }
 140  
             }
 141  
         }
 142  0
         catch ( ArtifactDeploymentException e )
 143  
         {
 144  0
             throw new BuildException(
 145  
                 "Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
 146  0
         }
 147  0
     }
 148  
 
 149  
     private ArtifactRepository getDeploymentRepository( Pom pom, Artifact artifact )
 150  
     {
 151  0
         DistributionManagement distributionManagement = pom.getDistributionManagement();
 152  
 
 153  0
         if ( remoteSnapshotRepository == null && remoteRepository == null )
 154  
         {
 155  0
             if ( distributionManagement != null )
 156  
             {
 157  0
                 if ( distributionManagement.getSnapshotRepository() != null )
 158  
                 {
 159  0
                     remoteSnapshotRepository = createAntRemoteRepositoryBase( distributionManagement
 160  
                         .getSnapshotRepository() );
 161  0
                     uniqueVersion = distributionManagement.getSnapshotRepository().isUniqueVersion();
 162  
                 }
 163  0
                 if ( distributionManagement.getRepository() != null )
 164  
                 {
 165  0
                     remoteRepository = createAntRemoteRepositoryBase( distributionManagement.getRepository() );
 166  
                 }
 167  
             }
 168  
         }
 169  
 
 170  0
         if ( remoteSnapshotRepository == null )
 171  
         {
 172  0
             remoteSnapshotRepository = remoteRepository;
 173  
         }
 174  
 
 175  
         ArtifactRepository deploymentRepository;
 176  0
         if ( artifact.isSnapshot() && remoteSnapshotRepository != null )
 177  
         {
 178  0
             deploymentRepository = createDeploymentArtifactRepository( remoteSnapshotRepository );
 179  
         }
 180  0
         else if ( remoteRepository != null )
 181  
         {
 182  0
             deploymentRepository = createDeploymentArtifactRepository( remoteRepository );
 183  
         }
 184  
         else
 185  
         {
 186  0
             throw new BuildException(
 187  
                 "A distributionManagement element or remoteRepository element is required to deploy" );
 188  
         }
 189  
 
 190  0
         return deploymentRepository;
 191  
     }
 192  
 
 193  
     public RemoteRepository getRemoteRepository()
 194  
     {
 195  0
         return remoteRepository;
 196  
     }
 197  
 
 198  
     public void addRemoteSnapshotRepository( RemoteRepository remoteSnapshotRepository )
 199  
     {
 200  0
         this.remoteSnapshotRepository = remoteSnapshotRepository;
 201  0
     }
 202  
 
 203  
     public void addRemoteRepository( RemoteRepository remoteRepository )
 204  
     {
 205  0
         this.remoteRepository = remoteRepository;
 206  0
     }
 207  
 
 208  
     public void setUniqueVersion( boolean uniqueVersion )
 209  
     {
 210  0
         this.uniqueVersion = uniqueVersion;
 211  0
     }
 212  
 
 213  
     public boolean getUniqueVersion()
 214  
     {
 215  0
         return uniqueVersion;
 216  
     }
 217  
 }
+ + + + Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DeployTask.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.DeployTask.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallDeployTaskSupport.html ============================================================================== --- websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallDeployTaskSupport.html (added) +++ websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallDeployTaskSupport.html Thu Mar 1 18:57:40 2012 @@ -0,0 +1,171 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.maven.artifact.ant.InstallDeployTaskSupport
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
InstallDeployTaskSupport
0%
0/13
0%
0/4
0
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.maven.artifact.ant;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.File;
 23  
 import java.util.ArrayList;
 24  
 import java.util.List;
 25  
 
 26  
 import org.apache.maven.artifact.repository.ArtifactRepository;
 27  
 
 28  
 /**
 29  
  * Support for install/deploy tasks.
 30  
  *
 31  
  * @author <a href="mailto:jdillon@apache.org">Jason Dillon</a>
 32  
  * @version $Id$
 33  
  */
 34  0
 public abstract class InstallDeployTaskSupport
 35  
     extends AbstractArtifactTask
 36  
 {
 37  
     /**
 38  
      * The file to install/deploy.
 39  
      */
 40  
     protected File file;
 41  
 
 42  
     /**
 43  
      * Additional attached artifacts to install/deploy
 44  
      */
 45  0
     protected List<AttachedArtifact> attachedArtifacts = new ArrayList<AttachedArtifact>();
 46  
 
 47  
     public File getFile()
 48  
     {
 49  0
         return file;
 50  
     }
 51  
 
 52  
     public void setFile( File file )
 53  
     {
 54  0
         this.file = file;
 55  0
     }
 56  
 
 57  
     public Pom initializePom( ArtifactRepository localArtifactRepository )
 58  
     {
 59  0
         Pom pom = super.initializePom( localArtifactRepository );
 60  
 
 61  
         // attach artifacts
 62  0
         if ( attachedArtifacts != null )
 63  
         {
 64  0
             for ( AttachedArtifact attached : attachedArtifacts )
 65  
             {
 66  0
                 pom.attach( attached );
 67  
             }
 68  
         }
 69  
 
 70  0
         return pom;
 71  
     }
 72  
 
 73  
     public AttachedArtifact createAttach()
 74  
     {
 75  0
         AttachedArtifact attach = new AttachedArtifact();
 76  0
         attachedArtifacts.add( attach );
 77  
 
 78  0
         return attach;
 79  
     }
 80  
 }
+ + + + Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallDeployTaskSupport.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallDeployTaskSupport.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallTask.html ============================================================================== --- websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallTask.html (added) +++ websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallTask.html Thu Mar 1 18:57:40 2012 @@ -0,0 +1,192 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.maven.artifact.ant.InstallTask
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
InstallTask
0%
0/24
0%
0/16
0
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.maven.artifact.ant;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.artifact.Artifact;
 23  
 import org.apache.maven.artifact.installer.ArtifactInstallationException;
 24  
 import org.apache.maven.artifact.installer.ArtifactInstaller;
 25  
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 26  
 import org.apache.maven.artifact.repository.ArtifactRepository;
 27  
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
 28  
 import org.apache.tools.ant.BuildException;
 29  
 
 30  
 /**
 31  
  * Install task, using maven-artifact.
 32  
  *
 33  
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
 34  
  * @version $Id$
 35  
  * @todo should be able to incorporate into the install mojo?
 36  
  */
 37  0
 public class InstallTask
 38  
     extends InstallDeployTaskSupport
 39  
 {
 40  
     protected void doExecute()
 41  
     {
 42  0
         if ( file == null && ( attachedArtifacts.size() == 0 ) )
 43  
         {
 44  0
             throw new BuildException( "You must specify a file and/or an attached artifact "
 45  
                 + "to install to the local repository." );
 46  
         }
 47  
 
 48  0
         ArtifactRepository localRepo = createLocalArtifactRepository();
 49  
 
 50  0
         Pom pom = initializePom( localRepo );
 51  
 
 52  0
         if ( pom == null )
 53  
         {
 54  0
             throw new BuildException( "A POM element is required to install to the local repository" );
 55  
         }
 56  
 
 57  0
         Artifact artifact = pom.getArtifact();
 58  
 
 59  0
         boolean isPomArtifact = "pom".equals( pom.getPackaging() );
 60  0
         if ( !isPomArtifact )
 61  
         {
 62  0
             ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom.getFile() );
 63  0
             artifact.addMetadata( metadata );
 64  
         }
 65  
 
 66  0
         ArtifactInstaller installer = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE );
 67  
         try
 68  
         {
 69  0
             if ( file != null )
 70  
             {
 71  0
                 if ( !isPomArtifact )
 72  
                 {
 73  0
                     installer.install( file, artifact, localRepo );
 74  
                 }
 75  
                 else
 76  
                 {
 77  0
                     installer.install( pom.getFile(), artifact, localRepo );
 78  
                 }
 79  
             }
 80  
 
 81  
             // Install any attached artifacts
 82  0
             if ( attachedArtifacts != null )
 83  
             {
 84  0
                 for ( Artifact attachedArtifact : pom.getAttachedArtifacts() )
 85  
                 {
 86  0
                     installer.install( attachedArtifact.getFile(), attachedArtifact, localRepo );
 87  
                 }
 88  
             }
 89  
         }
 90  0
         catch ( ArtifactInstallationException e )
 91  
         {
 92  0
             throw new BuildException(
 93  
                 "Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
 94  0
         }
 95  0
     }
 96  
 }
+ + + + Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallTask.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/maventest/content/ant-tasks-2.1.3/cobertura/org.apache.maven.artifact.ant.InstallTask.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision