001package org.apache.maven.plugin.internal;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.List;
023
024import org.apache.maven.model.Plugin;
025import org.apache.maven.plugin.PluginResolutionException;
026import org.eclipse.aether.RepositorySystemSession;
027import org.eclipse.aether.artifact.Artifact;
028import org.eclipse.aether.graph.DependencyFilter;
029import org.eclipse.aether.graph.DependencyNode;
030import org.eclipse.aether.repository.RemoteRepository;
031
032/**
033 * Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility interface
034 * that is only public for technical reasons, it is not part of the public API. In particular, this interface can be
035 * changed or deleted without prior notice.
036 *
037 * @since 3.0
038 * @author Benjamin Bentmann
039 */
040public interface PluginDependenciesResolver
041{
042
043    /**
044     * Resolves the main artifact of the specified plugin.
045     *
046     * @param plugin The plugin for which to resolve the main artifact, must not be {@code null}.
047     * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
048     *            null}.
049     * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
050     * @return The resolved plugin artifact, never {@code null}.
051     * @throws PluginResolutionException If the plugin artifact could not be resolved.
052     */
053    Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
054        throws PluginResolutionException;
055
056    /**
057     * Resolves the runtime dependencies of the specified plugin.
058     *
059     * @param plugin The plugin for which to resolve the dependencies, must not be {@code null}.
060     * @param pluginArtifact The plugin's main artifact, may be {@code null}.
061     * @param dependencyFilter A filter to exclude artifacts from resolution (but not collection), may be {@code null}.
062     * @param repositories The plugin repositories to use for resolving the plugin artifacts, must not be {@code null}.
063     * @param session The repository session to use for resolving the plugin artifacts, must not be {@code null}.
064     * @return The dependency tree denoting the resolved plugin class path, never {@code null}.
065     * @throws PluginResolutionException If any dependency could not be resolved.
066     */
067    DependencyNode resolve( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,
068                            List<RemoteRepository> repositories, RepositorySystemSession session )
069        throws PluginResolutionException;
070
071}