View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a 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,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.internal;
20  
21  import java.util.List;
22  
23  import org.apache.maven.model.Plugin;
24  import org.apache.maven.plugin.PluginResolutionException;
25  import org.eclipse.aether.RepositorySystemSession;
26  import org.eclipse.aether.artifact.Artifact;
27  import org.eclipse.aether.graph.DependencyFilter;
28  import org.eclipse.aether.graph.DependencyNode;
29  import org.eclipse.aether.repository.RemoteRepository;
30  
31  /**
32   * Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility interface
33   * that is only public for technical reasons, it is not part of the public API. In particular, this interface can be
34   * changed or deleted without prior notice.
35   *
36   * @since 3.0
37   */
38  public interface PluginDependenciesResolver {
39  
40      /**
41       * Resolves the main artifact of the specified plugin.
42       *
43       * @param plugin The plugin for which to resolve the main artifact, must not be {@code null}.
44       * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
45       *            null}.
46       * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
47       * @return The resolved plugin artifact, never {@code null}.
48       * @throws PluginResolutionException If the plugin artifact could not be resolved.
49       */
50      Artifact resolve(Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session)
51              throws PluginResolutionException;
52  
53      /**
54       * Resolves the runtime dependencies of the specified plugin.
55       *
56       * @param plugin The plugin for which to resolve the dependencies, must not be {@code null}.
57       * @param pluginArtifact The plugin's main artifact, may be {@code null}.
58       * @param dependencyFilter A filter to exclude artifacts from resolution (but not collection), may be {@code null}.
59       * @param repositories The plugin repositories to use for resolving the plugin artifacts, must not be {@code null}.
60       * @param session The repository session to use for resolving the plugin artifacts, must not be {@code null}.
61       * @return The dependency tree denoting the resolved plugin class path, never {@code null}.
62       * @throws PluginResolutionException If any dependency could not be resolved.
63       */
64      DependencyNode resolve(
65              Plugin plugin,
66              Artifact pluginArtifact,
67              DependencyFilter dependencyFilter,
68              List<RemoteRepository> repositories,
69              RepositorySystemSession session)
70              throws PluginResolutionException;
71  }