Save This Page
Home » maven-ant-tasks-2.1.0-src » org.apache » maven » artifact » ant » [javadoc | source]
    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.Iterator;
   25   import java.util.List;
   26   
   27   import org.apache.maven.artifact.repository.ArtifactRepository;
   28   
   29   /**
   30    * Support for install/deploy tasks.
   31    *
   32    * @author <a href="mailto:jdillon@apache.org">Jason Dillon</a>
   33    * @version $Id: InstallDeployTaskSupport.java 884304 2009-11-25 22:25:22Z pgier $
   34    */
   35   public abstract class InstallDeployTaskSupport
   36       extends AbstractArtifactTask
   37   {
   38       /**
   39        * The file to install/deploy.
   40        */
   41       protected File file;
   42   
   43       /**
   44        * Additional attached artifacts to install/deploy
   45        */
   46       protected List attachedArtifacts = new ArrayList();
   47   
   48       public File getFile()
   49       {
   50           return file;
   51       }
   52   
   53       public void setFile( File file )
   54       {
   55           this.file = file;
   56       }
   57       
   58       public Pom initializePom( ArtifactRepository localArtifactRepository )
   59       {
   60           Pom pom = super.initializePom( localArtifactRepository );
   61   
   62           // attach artifacts
   63           if ( attachedArtifacts != null )
   64           {
   65               Iterator iter = attachedArtifacts.iterator();
   66   
   67               while ( iter.hasNext() )
   68               {
   69                   AttachedArtifact attached = (AttachedArtifact) iter.next();
   70                   pom.attach( attached );
   71               }
   72           }
   73           
   74           return pom;
   75       }
   76   
   77       public AttachedArtifact createAttach()
   78       {
   79           AttachedArtifact attach = new AttachedArtifact();
   80           attachedArtifacts.add( attach );
   81   
   82           return attach;
   83       }
   84   }

Save This Page
Home » maven-ant-tasks-2.1.0-src » org.apache » maven » artifact » ant » [javadoc | source]