001 package org.codehaus.mojo.wagon;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
005 * agreements. See the NOTICE file distributed with this work for additional information regarding
006 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance with the License. You may obtain a
008 * copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software distributed under the License
013 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
014 * or implied. See the License for the specific language governing permissions and limitations under
015 * the License.
016 */
017
018 import java.io.IOException;
019
020 import org.apache.maven.wagon.Wagon;
021 import org.apache.maven.wagon.WagonException;
022 import org.codehaus.mojo.wagon.shared.WagonCopy;
023 import org.codehaus.mojo.wagon.shared.WagonFileSet;
024
025 /**
026 * Copy artifacts from one Wagon repository to another Wagon repository.
027 *
028 * @goal copy
029 * @requiresProject false
030 */
031 public class CopyMojo
032 extends AbstractCopyMojo
033 {
034 /**
035 * Directory path relative to source's Wagon
036 * @parameter expression="${wagon.fromDir}" default-value=""
037 */
038 private String fromDir = "";
039
040 /**
041 * Comma separated list of Ant's includes to scan for remote files
042 * @parameter expression="${wagon.includes}" default-value="**";
043 */
044 private String includes;
045
046 /**
047 * Comma separated list of Ant's excludes to scan for remote files
048 * @parameter expression="${wagon.excludes}"
049 *
050 */
051 private String excludes;
052
053 /**
054 * Whether to consider remote path case sensitivity during scan
055 * @parameter expression="${wagon.caseSensitive}"
056 */
057 private boolean caseSensitive = true;
058
059 /**
060 * Remote path relative to target's url to copy files to.
061 *
062 * @parameter expression="${wagon.toDir}" default-value="";
063 */
064 private String toDir = "";
065
066
067 /**
068 * @component
069 */
070 private WagonCopy wagonCopy;
071
072 protected void copy( Wagon srcWagon, Wagon targetWagon )
073 throws IOException, WagonException
074 {
075 WagonFileSet fileSet = this.getWagonFileSet( fromDir, includes, excludes, caseSensitive, toDir );
076
077 wagonCopy.copy( srcWagon, fileSet, targetWagon, optimize, this.getLog() );
078 }
079
080 }