View Javadoc

1   package org.apache.maven.plugin.internal;
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.List;
23  
24  import org.apache.maven.model.Plugin;
25  import org.apache.maven.plugin.PluginResolutionException;
26  import org.eclipse.aether.RepositorySystemSession;
27  import org.eclipse.aether.artifact.Artifact;
28  import org.eclipse.aether.graph.DependencyFilter;
29  import org.eclipse.aether.graph.DependencyNode;
30  import org.eclipse.aether.repository.RemoteRepository;
31  
32  /**
33   * Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility interface
34   * that is only public for technical reasons, it is not part of the public API. In particular, this interface can be
35   * changed or deleted without prior notice.
36   * 
37   * @since 3.0
38   * @author Benjamin Bentmann
39   */
40  public interface PluginDependenciesResolver
41  {
42  
43      /**
44       * Resolves the main artifact of the specified plugin.
45       * 
46       * @param plugin The plugin for which to resolve the main artifact, must not be {@code null}.
47       * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
48       *            null}.
49       * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
50       * @return The resolved plugin artifact, never {@code null}.
51       * @throws PluginResolutionException If the plugin artifact could not be resolved.
52       */
53      Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
54          throws PluginResolutionException;
55  
56      /**
57       * Resolves the runtime dependencies of the specified plugin.
58       * 
59       * @param plugin The plugin for which to resolve the dependencies, must not be {@code null}.
60       * @param pluginArtifact The plugin's main artifact, may be {@code null}.
61       * @param dependencyFilter A filter to exclude artifacts from resolution (but not collection), may be {@code null}.
62       * @param repositories The plugin repositories to use for resolving the plugin artifacts, must not be {@code null}.
63       * @param session The repository session to use for resolving the plugin artifacts, must not be {@code null}.
64       * @return The dependency tree denoting the resolved plugin class path, never {@code null}.
65       * @throws PluginResolutionException If any dependency could not be resolved.
66       */
67      DependencyNode resolve( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,
68                              List<RemoteRepository> repositories, RepositorySystemSession session )
69          throws PluginResolutionException;
70  
71  }