001package org.apache.maven.project;
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.artifact.InvalidRepositoryException;
025import org.apache.maven.artifact.repository.ArtifactRepository;
026import org.apache.maven.model.Model;
027import org.apache.maven.model.Repository;
028import org.apache.maven.plugin.PluginManagerException;
029import org.apache.maven.plugin.PluginResolutionException;
030import org.apache.maven.plugin.version.PluginVersionResolutionException;
031
032/**
033 * Assists the project builder. <strong>Warning:</strong> This is an internal utility interface that is only public for
034 * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
035 * prior notice.
036 *
037 * @author Benjamin Bentmann
038 */
039public interface ProjectBuildingHelper
040{
041
042    /**
043     * Creates the effective artifact repositories from the specified POM repositories.
044     *
045     * @param pomRepositories The POM repositories to create the artifact repositories from, must not be {@code null}.
046     * @param externalRepositories The external (and already mirrored) repositories to merge into the result list, may
047     *            be {@code null}.
048     * @param request The project building request holding further settings like repository settings, must not be
049     *            {@code null}.
050     * @return The effective artifact repositories, never {@code null}.
051     * @throws InvalidRepositoryException
052     */
053    List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
054                                                         List<ArtifactRepository> externalRepositories,
055                                                         ProjectBuildingRequest request )
056        throws InvalidRepositoryException;
057
058    /**
059     * Creates the project realm that hosts the build extensions of the specified model.
060     *
061     * @param project The project to create the project realm for, must not be {@code null}
062     * @param model The model to create the project realm for, must not be {@code null}
063     * @param request The project building request holding further settings like repository settings, must not be
064     *            {@code null}.
065     * @return The record with the project realm and extension artifact filter, never {@code null}.
066     * @throws PluginResolutionException If any build extension could not be resolved.
067     */
068    ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
069                                                      ProjectBuildingRequest request )
070        throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException;
071
072    /**
073     * Updates the context class loader such that the container will search the project realm when the model builder
074     * injects the lifecycle bindings from the packaging in the next step. The context class loader is to be reset by
075     * the project builder when the project is fully assembled.
076     *
077     * @param project The project whose class realm should be selected, must not be {@code null}.
078     */
079    void selectProjectRealm( MavenProject project );
080
081}