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.reporting.exec;
20  
21  import java.util.List;
22  
23  import org.apache.maven.execution.MavenSession;
24  import org.apache.maven.model.Plugin;
25  import org.apache.maven.plugin.InvalidPluginDescriptorException;
26  import org.apache.maven.plugin.PluginContainerException;
27  import org.apache.maven.plugin.PluginDescriptorParsingException;
28  import org.apache.maven.plugin.PluginResolutionException;
29  import org.apache.maven.plugin.descriptor.PluginDescriptor;
30  
31  /**
32   * {@link org.apache.maven.plugin.MavenPluginManager} helper to deal with API changes between Maven 3.0.x and 3.1.x, ie
33   * switch from Sonatype Aether (in <code>org.sonatype.aether</code> package) to Eclipse Aether (in
34   * <code>org.eclipse.aether</code> package) for some parameters.
35   *
36   * @author Hervé Boutemy
37   * @since 1.1
38   */
39  public interface MavenPluginManagerHelper {
40      /**
41       * Helper for {@link org.apache.maven.plugin.MavenPluginManager#getPluginDescriptor
42       * MavenPluginManager#getPluginDescriptor(Plugin, List, xxx.aether.RepositorySystemSession)}
43       *
44       * @param plugin the plugin
45       * @param session the session
46       * @return the plugin descriptor
47       * @throws PluginResolutionException on resolution issue
48       * @throws PluginDescriptorParsingException on descriptor parsing issue
49       * @throws InvalidPluginDescriptorException on invalid descriptor
50       */
51      PluginDescriptor getPluginDescriptor(Plugin plugin, MavenSession session)
52              throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
53  
54      /**
55       * Helper for {@link org.apache.maven.plugin.MavenPluginManager#setupPluginRealm
56       * MavenPluginManager#setupPluginRealm(PluginDescriptor, ..., List, xxx.aether.graph.DependencyFilter)}
57       *
58       * @param pluginDescriptor the plugin descriptor
59       * @param session the session
60       * @param parent the parent classloader
61       * @param imports classloader imports
62       * @param excludeArtifactIds artifacts excluded from classloader
63       * @throws PluginResolutionException on resolution issue
64       * @throws PluginContainerException on issue with configuration
65       */
66      void setupPluginRealm(
67              PluginDescriptor pluginDescriptor,
68              MavenSession session,
69              ClassLoader parent,
70              List<String> imports,
71              List<String> excludeArtifactIds)
72              throws PluginResolutionException, PluginContainerException;
73  }