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.project;
20  
21  import java.util.List;
22  
23  import org.apache.maven.artifact.InvalidRepositoryException;
24  import org.apache.maven.artifact.repository.ArtifactRepository;
25  import org.apache.maven.model.Model;
26  import org.apache.maven.model.Repository;
27  import org.apache.maven.plugin.PluginManagerException;
28  import org.apache.maven.plugin.PluginResolutionException;
29  import org.apache.maven.plugin.version.PluginVersionResolutionException;
30  
31  /**
32   * Assists the project builder. <strong>Warning:</strong> This is an internal utility interface that is only public for
33   * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
34   * prior notice.
35   *
36   * @author Benjamin Bentmann
37   */
38  public interface ProjectBuildingHelper {
39  
40      /**
41       * Creates the effective artifact repositories from the specified POM repositories.
42       *
43       * @param pomRepositories The POM repositories to create the artifact repositories from, must not be {@code null}.
44       * @param externalRepositories The external (and already mirrored) repositories to merge into the result list, may
45       *            be {@code null}.
46       * @param request The project building request holding further settings like repository settings, must not be
47       *            {@code null}.
48       * @return The effective artifact repositories, never {@code null}.
49       * @throws InvalidRepositoryException
50       */
51      List<ArtifactRepository> createArtifactRepositories(
52              List<Repository> pomRepositories,
53              List<ArtifactRepository> externalRepositories,
54              ProjectBuildingRequest request)
55              throws InvalidRepositoryException;
56  
57      /**
58       * Creates the project realm that hosts the build extensions of the specified model.
59       *
60       * @param project The project to create the project realm for, must not be {@code null}
61       * @param model The model to create the project realm for, must not be {@code null}
62       * @param request The project building request holding further settings like repository settings, must not be
63       *            {@code null}.
64       * @return The record with the project realm and extension artifact filter, never {@code null}.
65       * @throws PluginResolutionException If any build extension could not be resolved.
66       */
67      ProjectRealmCache.CacheRecord createProjectRealm(MavenProject project, Model model, ProjectBuildingRequest request)
68              throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException;
69  
70      /**
71       * Updates the context class loader such that the container will search the project realm when the model builder
72       * injects the lifecycle bindings from the packaging in the next step. The context class loader is to be reset by
73       * the project builder when the project is fully assembled.
74       *
75       * @param project The project whose class realm should be selected, must not be {@code null}.
76       */
77      void selectProjectRealm(MavenProject project);
78  }