1 package org.apache.maven.plugin.dependency.resolvers;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.util.Iterator;
23 import java.util.Set;
24
25 import org.apache.maven.artifact.Artifact;
26 import org.apache.maven.plugin.MojoExecutionException;
27 import org.apache.maven.plugin.dependency.AbstractResolveMojo;
28 import org.apache.maven.plugin.dependency.utils.DependencyUtil;
29 import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
30
31 /**
32 * Goal that resolves all project dependencies, including plugins and reports
33 * and their dependencies.
34 *
35 * @goal go-offline
36 * @execute goal=resolve-plugins
37 * @requiresDependencyResolution test
38 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
39 * @version $Id: GoOfflineMojo.java 728546 2008-12-21 22:56:51Z bentmann $
40 * @since 2.0
41 */
42 public class GoOfflineMojo
43 extends AbstractResolveMojo
44 {
45
46 /**
47 * Main entry into mojo. Gets the list of dependencies and iterates through
48 * displaying the resolved version.
49 *
50 * @throws MojoExecutionException
51 * with a message if an error occurs.
52 *
53 */
54 public void execute()
55 throws MojoExecutionException
56 {
57 Set artifacts = project.getArtifacts();
58
59 if ( !silent )
60 {
61 for ( Iterator i = artifacts.iterator(); i.hasNext(); )
62 {
63 this.getLog().info( "Resolved: " + DependencyUtil.getFormattedFileName( (Artifact) i.next(), false ) );
64 }
65 }
66 }
67
68 protected ArtifactsFilter getMarkedArtifactFilter()
69 {
70 // TODO Auto-generated method stub
71 return null;
72 }
73 }