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.util.Iterator;
19 import java.util.List;
20
21 import org.apache.maven.plugin.MojoExecutionException;
22 import org.apache.maven.wagon.Wagon;
23 import org.apache.maven.wagon.WagonException;
24
25 /**
26 * Lists the content of the specified directory (remotePath) under a specified repository (url)
27 *
28 * @goal list
29 * @requiresProject false
30 */
31 public class ListMojo extends AbstractWagonListMojo {
32
33 @Override
34 protected void execute(Wagon wagon) throws MojoExecutionException, WagonException {
35 List<?> files = wagonDownload.getFileList(wagon, this.getWagonFileSet(), this.getLog());
36
37 for (Iterator<?> iterator = files.iterator(); iterator.hasNext();) {
38 String file = (String) iterator.next();
39 getLog().info("\t" + file);
40 }
41 }
42 }