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.Date;
023import java.util.List;
024import java.util.Properties;
025
026import org.apache.maven.artifact.repository.ArtifactRepository;
027import org.apache.maven.model.Profile;
028import org.eclipse.aether.RepositorySystemSession;
029
030public interface ProjectBuildingRequest
031{
032
033    ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
034
035    ArtifactRepository getLocalRepository();
036
037    ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
038
039    List<ArtifactRepository> getRemoteRepositories();
040
041    ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories );
042
043    List<ArtifactRepository> getPluginArtifactRepositories();
044
045    /**
046     * Sets the system properties to use for interpolation and profile activation. The system properties are collected
047     * from the runtime environment like {@link System#getProperties()} and environment variables.
048     *
049     * @param systemProperties The system properties, may be {@code null}.
050     * @return This request, never {@code null}.
051     */
052    ProjectBuildingRequest setSystemProperties( Properties systemProperties );
053
054    /**
055     * Gets the system properties to use for interpolation and profile activation. The system properties are collected
056     * from the runtime environment like {@link System#getProperties()} and environment variables.
057     *
058     * @return The system properties, never {@code null}.
059     */
060    Properties getSystemProperties();
061
062    /**
063     * Sets the user properties to use for interpolation and profile activation. The user properties have been
064     * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
065     * line.
066     *
067     * @param userProperties The user properties, may be {@code null}.
068     * @return This request, never {@code null}.
069     */
070    ProjectBuildingRequest setUserProperties( Properties userProperties );
071
072    /**
073     * Gets the user properties to use for interpolation and profile activation. The user properties have been
074     * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
075     * line.
076     *
077     * @return The user properties, never {@code null}.
078     */
079    Properties getUserProperties();
080
081    void setProject( MavenProject mavenProject );
082
083    MavenProject getProject();
084
085    ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
086
087    boolean isProcessPlugins();
088
089    ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies );
090
091    boolean isResolveDependencies();
092
093    /**
094     * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
095     *
096     * @param validationLevel The level of validation to perform on processed models, e.g.
097     *            {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
098     * @return This configuration, never {@code null}.
099     */
100    ProjectBuildingRequest setValidationLevel( int validationLevel );
101
102    /**
103     * Gets the level of validation to perform on processed models.
104     *
105     * @return The level of validation to perform on processed models.
106     */
107    int getValidationLevel();
108
109    // Profiles
110
111    /**
112     * Set any active profiles that the {@link ProjectBuilder} should consider while constructing
113     * a {@link MavenProject}.
114     */
115    void setActiveProfileIds( List<String> activeProfileIds );
116
117    List<String> getActiveProfileIds();
118
119    void setInactiveProfileIds( List<String> inactiveProfileIds );
120
121    List<String> getInactiveProfileIds();
122
123    /**
124     * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom
125     * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
126     *
127     * @param profile
128     */
129    void addProfile( Profile profile );
130
131    void setProfiles( List<Profile> profiles );
132
133    List<Profile> getProfiles();
134
135    /**
136     * Gets the start time of the build.
137     *
138     * @return The start time of the build or {@code null} if unknown.
139     */
140    Date getBuildStartTime();
141
142    /**
143     * Sets the start time of the build.
144     *
145     * @param buildStartTime The start time of the build, may be {@code null}.
146     */
147    void setBuildStartTime( Date buildStartTime );
148
149    RepositorySystemSession getRepositorySession();
150
151    ProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession );
152
153    /**
154     * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this
155     * request.
156     *
157     * @param mode The repository merge mode, must not be {@code null}.
158     * @return This request for chaining, never {@code null}.
159     * @see #setRemoteRepositories(List)
160     */
161    ProjectBuildingRequest setRepositoryMerging( RepositoryMerging mode );
162
163    /**
164     * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this
165     * request
166     *
167     * @return The merge mode, never {@code null}.
168     */
169    RepositoryMerging getRepositoryMerging();
170
171    /** @since 3.2.2 */
172    boolean isResolveVersionRanges();
173
174    /** @since 3.2.2 */
175    ProjectBuildingRequest setResolveVersionRanges( boolean value );
176
177    /**
178     * The possible merge modes for combining remote repositories.
179     */
180    enum RepositoryMerging
181    {
182
183        /**
184         * The repositories declared in the POM have precedence over the repositories specified in the request.
185         */
186        POM_DOMINANT,
187
188        /**
189         * The repositories specified in the request have precedence over the repositories declared in the POM.
190         */
191        REQUEST_DOMINANT,
192    }
193
194}