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 /*
19 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
20 * agreements. See the NOTICE file distributed with this work for additional information regarding
21 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
22 * "License"); you may not use this file except in compliance with the License. You may obtain a
23 * copy of the License at
24 *
25 * http://www.apache.org/licenses/LICENSE-2.0
26 *
27 * Unless required by applicable law or agreed to in writing, software distributed under the License
28 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
29 * or implied. See the License for the specific language governing permissions and limitations under
30 * the License.
31 */
32
33 import java.io.IOException;
34
35 import org.apache.maven.wagon.Wagon;
36 import org.apache.maven.wagon.WagonException;
37 import org.codehaus.mojo.wagon.shared.WagonCopy;
38 import org.codehaus.mojo.wagon.shared.WagonFileSet;
39
40 /**
41 * Copy artifacts from one Wagon repository to another Wagon repository.
42 *
43 * @goal copy
44 * @requiresProject false
45 */
46 public class CopyMojo
47 extends AbstractCopyMojo
48 {
49 /**
50 * Directory path relative to source's Wagon
51 * @parameter expression="${wagon.fromDir}" default-value=""
52 */
53 private String fromDir = "";
54
55 /**
56 * Comma separated list of Ant's includes to scan for remote files
57 * @parameter expression="${wagon.includes}" default-value="**";
58 */
59 private String includes;
60
61 /**
62 * Comma separated list of Ant's excludes to scan for remote files
63 * @parameter expression="${wagon.excludes}"
64 *
65 */
66 private String excludes;
67
68 /**
69 * Whether to consider remote path case sensitivity during scan
70 * @parameter expression="${wagon.caseSensitive}"
71 */
72 private boolean caseSensitive = true;
73
74 /**
75 * Remote path relative to target's url to copy files to.
76 *
77 * @parameter expression="${wagon.toDir}" default-value="";
78 */
79 private String toDir = "";
80
81
82 /**
83 * @component
84 */
85 private WagonCopy wagonCopy;
86
87 protected void copy( Wagon srcWagon, Wagon targetWagon )
88 throws IOException, WagonException
89 {
90 WagonFileSet fileSet = this.getWagonFileSet( fromDir, includes, excludes, caseSensitive, toDir );
91
92 wagonCopy.copy( srcWagon, fileSet, targetWagon, optimize, this.getLog() );
93 }
94
95 }