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  /**
31   * ProjectBuildingRequest
32   */
33  public interface ProjectBuildingRequest
34  {
35  
36      ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
37  
38      ArtifactRepository getLocalRepository();
39  
40      ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
41  
42      List<ArtifactRepository> getRemoteRepositories();
43  
44      ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories );
45  
46      List<ArtifactRepository> getPluginArtifactRepositories();
47  
48      /**
49       * Sets the system properties to use for interpolation and profile activation. The system properties are collected
50       * from the runtime environment like {@link System#getProperties()} and environment variables.
51       *
52       * @param systemProperties The system properties, may be {@code null}.
53       * @return This request, never {@code null}.
54       */
55      ProjectBuildingRequest setSystemProperties( Properties systemProperties );
56  
57      /**
58       * Gets the system properties to use for interpolation and profile activation. The system properties are collected
59       * from the runtime environment like {@link System#getProperties()} and environment variables.
60       *
61       * @return The system properties, never {@code null}.
62       */
63      Properties getSystemProperties();
64  
65      /**
66       * Sets the user properties to use for interpolation and profile activation. The user properties have been
67       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
68       * line.
69       *
70       * @param userProperties The user properties, may be {@code null}.
71       * @return This request, never {@code null}.
72       */
73      ProjectBuildingRequest setUserProperties( Properties userProperties );
74  
75      /**
76       * Gets the user properties to use for interpolation and profile activation. The user properties have been
77       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
78       * line.
79       *
80       * @return The user properties, never {@code null}.
81       */
82      Properties getUserProperties();
83  
84      void setProject( MavenProject mavenProject );
85  
86      MavenProject getProject();
87  
88      ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
89  
90      boolean isProcessPlugins();
91  
92      ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies );
93  
94      boolean isResolveDependencies();
95  
96      /**
97       * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
98       *
99       * @param validationLevel The level of validation to perform on processed models, e.g.
100      *            {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
101      * @return This configuration, never {@code null}.
102      */
103     ProjectBuildingRequest setValidationLevel( int validationLevel );
104 
105     /**
106      * Gets the level of validation to perform on processed models.
107      *
108      * @return The level of validation to perform on processed models.
109      */
110     int getValidationLevel();
111 
112     // Profiles
113 
114     /**
115      * Set any active profiles that the {@link ProjectBuilder} should consider while constructing
116      * a {@link MavenProject}.
117      */
118     void setActiveProfileIds( List<String> activeProfileIds );
119 
120     List<String> getActiveProfileIds();
121 
122     void setInactiveProfileIds( List<String> inactiveProfileIds );
123 
124     List<String> getInactiveProfileIds();
125 
126     /**
127      * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom
128      * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
129      *
130      * @param profile
131      */
132     void addProfile( Profile profile );
133 
134     void setProfiles( List<Profile> profiles );
135 
136     List<Profile> getProfiles();
137 
138     /**
139      * Gets the start time of the build.
140      *
141      * @return The start time of the build or {@code null} if unknown.
142      */
143     Date getBuildStartTime();
144 
145     /**
146      * Sets the start time of the build.
147      *
148      * @param buildStartTime The start time of the build, may be {@code null}.
149      */
150     void setBuildStartTime( Date buildStartTime );
151 
152     RepositorySystemSession getRepositorySession();
153 
154     ProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession );
155 
156     /**
157      * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this
158      * request.
159      *
160      * @param mode The repository merge mode, must not be {@code null}.
161      * @return This request for chaining, never {@code null}.
162      * @see #setRemoteRepositories(List)
163      */
164     ProjectBuildingRequest setRepositoryMerging( RepositoryMerging mode );
165 
166     /**
167      * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this
168      * request
169      *
170      * @return The merge mode, never {@code null}.
171      */
172     RepositoryMerging getRepositoryMerging();
173 
174     /**
175      * @since 3.2.2
176      * @deprecated This got added when implementing MNG-2199 and is no longer used.
177      * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
178      */
179     @Deprecated
180     boolean isResolveVersionRanges();
181 
182     /**
183      * @since 3.2.2
184      * @deprecated This got added when implementing MNG-2199 and is no longer used.
185      * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
186      */
187     @Deprecated
188     ProjectBuildingRequest setResolveVersionRanges( boolean value );
189 
190     /**
191      * The possible merge modes for combining remote repositories.
192      */
193     enum RepositoryMerging
194     {
195 
196         /**
197          * The repositories declared in the POM have precedence over the repositories specified in the request.
198          */
199         POM_DOMINANT,
200 
201         /**
202          * The repositories specified in the request have precedence over the repositories declared in the POM.
203          */
204         REQUEST_DOMINANT,
205     }
206 
207 }