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.Date;
23  import java.util.List;
24  import java.util.Properties;
25  
26  import org.apache.maven.artifact.repository.ArtifactRepository;
27  import org.apache.maven.model.Profile;
28  import org.eclipse.aether.RepositorySystemSession;
29  
30  public interface ProjectBuildingRequest
31  {
32  
33      ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
34  
35      ArtifactRepository getLocalRepository();
36  
37      ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
38  
39      List<ArtifactRepository> getRemoteRepositories();
40  
41      ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories );
42  
43      List<ArtifactRepository> getPluginArtifactRepositories();
44  
45      /**
46       * Sets the system properties to use for interpolation and profile activation. The system properties are collected
47       * from the runtime environment like {@link System#getProperties()} and environment variables.
48       *
49       * @param systemProperties The system properties, may be {@code null}.
50       * @return This request, never {@code null}.
51       */
52      ProjectBuildingRequest setSystemProperties( Properties systemProperties );
53  
54      /**
55       * Gets the system properties to use for interpolation and profile activation. The system properties are collected
56       * from the runtime environment like {@link System#getProperties()} and environment variables.
57       *
58       * @return The system properties, never {@code null}.
59       */
60      Properties getSystemProperties();
61  
62      /**
63       * Sets the user properties to use for interpolation and profile activation. The user properties have been
64       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
65       * line.
66       *
67       * @param userProperties The user properties, may be {@code null}.
68       * @return This request, never {@code null}.
69       */
70      ProjectBuildingRequest setUserProperties( Properties userProperties );
71  
72      /**
73       * Gets the user properties to use for interpolation and profile activation. The user properties have been
74       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
75       * line.
76       *
77       * @return The user properties, never {@code null}.
78       */
79      Properties getUserProperties();
80  
81      void setProject( MavenProject mavenProject );
82  
83      MavenProject getProject();
84  
85      ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
86  
87      boolean isProcessPlugins();
88  
89      ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies );
90  
91      boolean isResolveDependencies();
92  
93      /**
94       * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
95       *
96       * @param validationLevel The level of validation to perform on processed models, e.g.
97       *            {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
98       * @return This configuration, never {@code null}.
99       */
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 }