001package org.apache.maven.execution;
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 org.apache.maven.settings.Settings;
023import org.apache.maven.toolchain.model.PersistedToolchains;
024
025/**
026 * Assists in populating an execution request for invocation of Maven.
027 *
028 * @author Benjamin Bentmann
029 */
030public interface MavenExecutionRequestPopulator
031{
032    /**
033     * Copies the values from the given toolchains into the specified execution request. This method will replace any
034     * existing values in the execution request that are controlled by the toolchains. Hence, it is expected that this
035     * method is called on a new/empty execution request before the caller mutates it to fit its needs.
036     *
037     * @param request The execution request to populate, must not be {@code null}.
038     * @param toolchains The toolchains to copy into the execution request, may be {@code null}.
039     * @return The populated execution request, never {@code null}.
040     * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
041     * @since 3.3.0
042     */
043    MavenExecutionRequest populateFromToolchains( MavenExecutionRequest request, PersistedToolchains toolchains )
044        throws MavenExecutionRequestPopulationException;
045
046    /**
047     * Injects default values like plugin groups or repositories into the specified execution request.
048     *
049     * @param request The execution request to populate, must not be {@code null}.
050     * @return The populated execution request, never {@code null}.
051     * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
052     */
053    MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
054        throws MavenExecutionRequestPopulationException;
055
056    /*if_not[MAVEN4]*/
057    
058    /**
059     * Copies the values from the given settings into the specified execution request. This method will replace any
060     * existing values in the execution request that are controlled by the settings. Hence, it is expected that this
061     * method is called on a new/empty execution request before the caller mutates it to fit its needs.
062     *
063     * @param request The execution request to populate, must not be {@code null}.
064     * @param settings The settings to copy into the execution request, may be {@code null}.
065     * @return The populated execution request, never {@code null}.
066     * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
067     */
068    @Deprecated
069    MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
070        throws MavenExecutionRequestPopulationException;
071
072    /*end[MAVEN4]*/
073
074}