View Javadoc

1   /**
2    * Copyright 2008-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.codehaus.mojo.wagon;
17  
18  import java.io.File;
19  
20  import org.apache.maven.wagon.Wagon;
21  import org.apache.maven.wagon.WagonException;
22  import org.codehaus.mojo.wagon.shared.WagonFileSet;
23  
24  /**
25   * Transfers a set of files from a remote URL to a specified local directory.
26   *
27   * @goal download
28   * @requiresProject false
29   */
30  public class DownloadMojo extends AbstractWagonListMojo {
31  
32      /**
33       * Local directory that files are downloaded to
34       *
35       * @parameter expression="${wagon.toDir}" default-value="${project.build.directory}/wagon-plugin"
36       */
37      private File toDir;
38  
39      /**
40       * If true, files that already exist on the local file system are not downloaded
41       *
42       * @parameter expression="${wagon.skipExisting}" default-value="false"
43       */
44      private boolean skipExisting;
45  
46      @Override
47      protected void execute(Wagon wagon) throws WagonException {
48          WagonFileSet fileSet = this.getWagonFileSet();
49          fileSet.setDownloadDirectory(this.toDir);
50          this.wagonDownload.download(wagon, fileSet, this.getLog(), skipExisting);
51      }
52  
53  }