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  import org.eclipse.aether.resolution.DependencyResult;
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   */
39  public interface PluginDependenciesResolver {
40  
41      /**
42       * Resolves the main artifact of the specified plugin.
43       *
44       * @param plugin The plugin for which to resolve the main artifact, must not be {@code null}.
45       * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
46       *            null}.
47       * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
48       * @return The resolved plugin artifact, never {@code null}.
49       * @throws PluginResolutionException If the plugin artifact could not be resolved.
50       */
51      Artifact resolve(Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session)
52              throws PluginResolutionException;
53  
54      /**
55       * Resolves the runtime dependencies of the specified plugin.
56       *
57       * @param plugin The plugin for which to resolve the dependencies, must not be {@code null}.
58       * @param pluginArtifact The plugin's main artifact, may be {@code null}.
59       * @param dependencyFilter A filter to exclude artifacts from resolution (but not collection), may be {@code null}.
60       * @param repositories The plugin repositories to use for resolving the plugin artifacts, must not be {@code null}.
61       * @param session The repository session to use for resolving the plugin artifacts, must not be {@code null}.
62       * @return The dependency tree denoting the resolved plugin class path, never {@code null}.
63       * @throws PluginResolutionException If any dependency could not be resolved.
64       */
65      DependencyNode resolve(
66              Plugin plugin,
67              Artifact pluginArtifact,
68              DependencyFilter dependencyFilter,
69              List<RemoteRepository> repositories,
70              RepositorySystemSession session)
71              throws PluginResolutionException;
72  
73      DependencyResult resolvePlugin(
74              Plugin plugin,
75              Artifact artifact,
76              DependencyFilter dependencyFilter,
77              List<RemoteRepository> remotePluginRepositories,
78              RepositorySystemSession repositorySession)
79              throws PluginResolutionException;
80  }