1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.project;
20
21 import java.time.Instant;
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 * @deprecated use {@code org.apache.maven.api.services.ProjectBuilder} instead
34 */
35 @Deprecated(since = "4.0.0")
36 public interface ProjectBuildingRequest {
37
38 ProjectBuildingRequest setLocalRepository(ArtifactRepository localRepository);
39
40 ArtifactRepository getLocalRepository();
41
42 ProjectBuildingRequest setRemoteRepositories(List<ArtifactRepository> remoteRepositories);
43
44 List<ArtifactRepository> getRemoteRepositories();
45
46 ProjectBuildingRequest setPluginArtifactRepositories(List<ArtifactRepository> pluginArtifactRepositories);
47
48 List<ArtifactRepository> getPluginArtifactRepositories();
49
50 /**
51 * Sets the system properties to use for interpolation and profile activation. The system properties are collected
52 * from the runtime environment like {@link System#getProperties()} and environment variables.
53 *
54 * @param systemProperties The system properties, may be {@code null}.
55 * @return This request, never {@code null}.
56 */
57 ProjectBuildingRequest setSystemProperties(Properties systemProperties);
58
59 /**
60 * Gets the system properties to use for interpolation and profile activation. The system properties are collected
61 * from the runtime environment like {@link System#getProperties()} and environment variables.
62 *
63 * @return The system properties, never {@code null}.
64 */
65 Properties getSystemProperties();
66
67 /**
68 * Sets the user properties to use for interpolation and profile activation. The user properties have been
69 * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
70 * line.
71 *
72 * @param userProperties The user properties, may be {@code null}.
73 * @return This request, never {@code null}.
74 */
75 ProjectBuildingRequest setUserProperties(Properties userProperties);
76
77 /**
78 * Gets the user properties to use for interpolation and profile activation. The user properties have been
79 * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
80 * line.
81 *
82 * @return The user properties, never {@code null}.
83 */
84 Properties getUserProperties();
85
86 void setProject(MavenProject mavenProject);
87
88 MavenProject getProject();
89
90 ProjectBuildingRequest setProcessPlugins(boolean processPlugins);
91
92 boolean isProcessPlugins();
93
94 ProjectBuildingRequest setResolveDependencies(boolean resolveDependencies);
95
96 boolean isResolveDependencies();
97
98 /**
99 * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
100 *
101 * @param validationLevel The level of validation to perform on processed models, e.g.
102 * {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
103 * @return This configuration, never {@code null}.
104 */
105 ProjectBuildingRequest setValidationLevel(int validationLevel);
106
107 /**
108 * Gets the level of validation to perform on processed models.
109 *
110 * @return The level of validation to perform on processed models.
111 */
112 int getValidationLevel();
113
114 // Profiles
115
116 /**
117 * Set any active profiles that the {@link ProjectBuilder} should consider while constructing
118 * a {@link MavenProject}.
119 */
120 void setActiveProfileIds(List<String> activeProfileIds);
121
122 List<String> getActiveProfileIds();
123
124 void setInactiveProfileIds(List<String> inactiveProfileIds);
125
126 List<String> getInactiveProfileIds();
127
128 /**
129 * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom
130 * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
131 *
132 * @param profile
133 */
134 void addProfile(Profile profile);
135
136 void setProfiles(List<Profile> profiles);
137
138 List<Profile> getProfiles();
139
140 /**
141 * Gets the start time of the build.
142 *
143 * @return The start time of the build or {@code null} if unknown.
144 */
145 @Deprecated
146 Date getBuildStartTime();
147
148 /**
149 * Sets the start time of the build.
150 *
151 * @param buildStartTime The start time of the build, may be {@code null}.
152 */
153 @Deprecated
154 void setBuildStartTime(Date buildStartTime);
155
156 /**
157 * Gets the start time of the build.
158 *
159 * @return The start time of the build or {@code null} if unknown.
160 */
161 Instant getBuildStartInstant();
162
163 /**
164 * Sets the start time of the build.
165 *
166 * @param buildStartInstant The start time of the build, may be {@code null}.
167 */
168 void setBuildStartInstant(Instant buildStartInstant);
169
170 RepositorySystemSession getRepositorySession();
171
172 ProjectBuildingRequest setRepositorySession(RepositorySystemSession repositorySession);
173
174 /**
175 * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this
176 * request.
177 *
178 * @param mode The repository merge mode, must not be {@code null}.
179 * @return This request for chaining, never {@code null}.
180 * @see #setRemoteRepositories(List)
181 */
182 ProjectBuildingRequest setRepositoryMerging(RepositoryMerging mode);
183
184 /**
185 * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this
186 * request
187 *
188 * @return The merge mode, never {@code null}.
189 */
190 RepositoryMerging getRepositoryMerging();
191
192 /**
193 * @since 3.2.2
194 * @deprecated This got added when implementing MNG-2199 and is no longer used.
195 * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
196 */
197 @Deprecated
198 boolean isResolveVersionRanges();
199
200 /**
201 * @since 3.2.2
202 * @deprecated This got added when implementing MNG-2199 and is no longer used.
203 * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
204 */
205 @Deprecated
206 ProjectBuildingRequest setResolveVersionRanges(boolean value);
207
208 /**
209 * The possible merge modes for combining remote repositories.
210 */
211 enum RepositoryMerging {
212
213 /**
214 * The repositories declared in the POM have precedence over the repositories specified in the request.
215 */
216 POM_DOMINANT,
217
218 /**
219 * The repositories specified in the request have precedence over the repositories declared in the POM.
220 */
221 REQUEST_DOMINANT,
222 }
223 }