001    /**
002     * Copyright 2008-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.codehaus.mojo.wagon;
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 extends AbstractCopyMojo {
032    
033        /**
034         * Directory path relative to source's Wagon
035         *
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         *
043         * @parameter expression="${wagon.includes}" default-value="**";
044         */
045        private String includes;
046    
047        /**
048         * Comma separated list of Ant's excludes to scan for remote files
049         *
050         * @parameter expression="${wagon.excludes}"
051         */
052        private String excludes;
053    
054        /**
055         * Whether to consider remote path case sensitivity during scan
056         *
057         * @parameter expression="${wagon.caseSensitive}"
058         */
059        private boolean caseSensitive = true;
060    
061        /**
062         * Remote path relative to target's url to copy files to.
063         *
064         * @parameter expression="${wagon.toDir}" default-value="";
065         */
066        private String toDir = "";
067    
068        /**
069         * @component
070         */
071        private WagonCopy wagonCopy;
072    
073        @Override
074        protected void copy(Wagon srcWagon, Wagon targetWagon) throws IOException, WagonException {
075            WagonFileSet fileSet = getWagonFileSet(fromDir, includes, excludes, caseSensitive, toDir);
076            wagonCopy.copy(srcWagon, fileSet, targetWagon, optimize, getLog());
077        }
078    
079    }