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.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
32 extends AbstractCopyMojo
33 {
34 /**
35 * Directory path relative to source's Wagon
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 * @parameter expression="${wagon.includes}" default-value="**";
43 */
44 private String includes;
45
46 /**
47 * Comma separated list of Ant's excludes to scan for remote files
48 * @parameter expression="${wagon.excludes}"
49 *
50 */
51 private String excludes;
52
53 /**
54 * Whether to consider remote path case sensitivity during scan
55 * @parameter expression="${wagon.caseSensitive}"
56 */
57 private boolean caseSensitive = true;
58
59 /**
60 * Remote path relative to target's url to copy files to.
61 *
62 * @parameter expression="${wagon.toDir}" default-value="";
63 */
64 private String toDir = "";
65
66
67 /**
68 * @component
69 */
70 private WagonCopy wagonCopy;
71
72 protected void copy( Wagon srcWagon, Wagon targetWagon )
73 throws IOException, WagonException
74 {
75 WagonFileSet fileSet = this.getWagonFileSet( fromDir, includes, excludes, caseSensitive, toDir );
76
77 wagonCopy.copy( srcWagon, fileSet, targetWagon, optimize, this.getLog() );
78 }
79
80 }