1 package org.codehaus.mojo.wagon;
2
3 /**
4 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
5 * agreements. See the NOTICE file distributed with this work for additional information regarding
6 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance with the License. You may obtain a
8 * copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
15 * the License.
16 */
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
31 extends AbstractWagonListMojo
32 {
33
34 /**
35 * Local directory to download the remote resource ( tree ) to.
36 *
37 * @parameter expression="${wagon.toDir}" default-value="${project.build.directory}/wagon-plugin"
38 */
39 private File toDir;
40
41
42 protected void execute( Wagon wagon )
43 throws WagonException
44 {
45 WagonFileSet fileSet = this.getWagonFileSet();
46 fileSet.setDownloadDirectory( this.toDir );
47
48 this.wagonDownload.download( wagon, fileSet, this.getLog() );
49 }
50
51 }