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.IOException;
19
20 import org.apache.maven.wagon.Wagon;
21 import org.apache.maven.wagon.WagonException;
22 import org.codehaus.mojo.wagon.shared.WagonCopy;
23 import org.codehaus.mojo.wagon.shared.WagonFileSet;
24
25 /**
26 * Copy artifacts from one Wagon repository to another Wagon repository.
27 *
28 * @goal copy
29 * @requiresProject false
30 */
31 public class CopyMojo extends AbstractCopyMojo {
32
33 /**
34 * Directory path relative to source's Wagon
35 *
36 * @parameter expression="${wagon.fromDir}" default-value=""
37 */
38 private String fromDir = "";
39
40 /**
41 * Comma separated list of Ant's includes to scan for remote files
42 *
43 * @parameter expression="${wagon.includes}" default-value="**";
44 */
45 private String includes;
46
47 /**
48 * Comma separated list of Ant's excludes to scan for remote files
49 *
50 * @parameter expression="${wagon.excludes}"
51 */
52 private String excludes;
53
54 /**
55 * Whether to consider remote path case sensitivity during scan
56 *
57 * @parameter expression="${wagon.caseSensitive}"
58 */
59 private boolean caseSensitive = true;
60
61 /**
62 * Remote path relative to target's url to copy files to.
63 *
64 * @parameter expression="${wagon.toDir}" default-value="";
65 */
66 private String toDir = "";
67
68 /**
69 * @component
70 */
71 private WagonCopy wagonCopy;
72
73 @Override
74 protected void copy(Wagon srcWagon, Wagon targetWagon) throws IOException, WagonException {
75 WagonFileSet fileSet = getWagonFileSet(fromDir, includes, excludes, caseSensitive, toDir);
76 wagonCopy.copy(srcWagon, fileSet, targetWagon, optimize, getLog());
77 }
78
79 }