View Javadoc
1   package org.apache.maven.project;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.List;
23  
24  import org.apache.maven.artifact.InvalidRepositoryException;
25  import org.apache.maven.artifact.repository.ArtifactRepository;
26  import org.apache.maven.model.Model;
27  import org.apache.maven.model.Repository;
28  import org.apache.maven.plugin.PluginManagerException;
29  import org.apache.maven.plugin.PluginResolutionException;
30  import org.apache.maven.plugin.version.PluginVersionResolutionException;
31  
32  /**
33   * Assists the project builder. <strong>Warning:</strong> This is an internal utility interface that is only public for
34   * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
35   * prior notice.
36   *
37   * @author Benjamin Bentmann
38   */
39  public interface ProjectBuildingHelper
40  {
41  
42      /**
43       * Creates the effective artifact repositories from the specified POM repositories.
44       *
45       * @param pomRepositories The POM repositories to create the artifact repositories from, must not be {@code null}.
46       * @param externalRepositories The external (and already mirrored) repositories to merge into the result list, may
47       *            be {@code null}.
48       * @param request The project building request holding further settings like repository settings, must not be
49       *            {@code null}.
50       * @return The effective artifact repositories, never {@code null}.
51       * @throws InvalidRepositoryException
52       */
53      List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
54                                                           List<ArtifactRepository> externalRepositories,
55                                                           ProjectBuildingRequest request )
56          throws InvalidRepositoryException;
57  
58      /**
59       * Creates the project realm that hosts the build extensions of the specified model.
60       *
61       * @param project The project to create the project realm for, must not be {@code null}
62       * @param model The model to create the project realm for, must not be {@code null}
63       * @param request The project building request holding further settings like repository settings, must not be
64       *            {@code null}.
65       * @return The record with the project realm and extension artifact filter, never {@code null}.
66       * @throws PluginResolutionException If any build extension could not be resolved.
67       */
68      ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
69                                                        ProjectBuildingRequest request )
70          throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException;
71  
72      /**
73       * Updates the context class loader such that the container will search the project realm when the model builder
74       * injects the lifecycle bindings from the packaging in the next step. The context class loader is to be reset by
75       * the project builder when the project is fully assembled.
76       *
77       * @param project The project whose class realm should be selected, must not be {@code null}.
78       */
79      void selectProjectRealm( MavenProject project );
80  
81  }