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.api;
20
21 import org.apache.maven.api.annotations.Config;
22
23 /**
24 * Configuration constants.
25 */
26 public final class Constants {
27
28 /**
29 * Maven home.
30 *
31 * @since 3.0.0
32 */
33 @Config(readOnly = true)
34 public static final String MAVEN_HOME = "maven.home";
35
36 /**
37 * Maven installation configuration directory.
38 *
39 * @since 4.0.0
40 */
41 @Config(defaultValue = "${maven.home}/conf")
42 public static final String MAVEN_INSTALLATION_CONF = "maven.installation.conf";
43
44 /**
45 * Maven user configuration directory.
46 *
47 * @since 4.0.0
48 */
49 @Config(defaultValue = "${user.home}/.m2")
50 public static final String MAVEN_USER_CONF = "maven.user.conf";
51
52 /**
53 * Maven project configuration directory.
54 *
55 * @since 4.0.0
56 */
57 @Config(defaultValue = "${session.rootDirectory}/.mvn")
58 public static final String MAVEN_PROJECT_CONF = "maven.project.conf";
59
60 /**
61 * Maven local repository.
62 *
63 * @since 3.0.0
64 */
65 @Config(defaultValue = "${maven.user.conf}/repository")
66 public static final String MAVEN_REPO_LOCAL = "maven.repo.local";
67
68 /**
69 * Maven central repository URL.
70 * The property will have the value of the <code>MAVEN_REPO_CENTRAL</code>
71 * environment variable if it is defined.
72 *
73 * @since 4.0.0
74 */
75 @Config(defaultValue = "https://repo.maven.apache.org/maven2")
76 public static final String MAVEN_REPO_CENTRAL = "maven.repo.central";
77
78 /**
79 * Maven installation settings.
80 *
81 * @since 4.0.0
82 */
83 @Config(defaultValue = "${maven.installation.conf}/settings.xml")
84 public static final String MAVEN_INSTALLATION_SETTINGS = "maven.installation.settings";
85
86 /**
87 * Maven user settings.
88 *
89 * @since 4.0.0
90 */
91 @Config(defaultValue = "${maven.user.conf}/settings.xml")
92 public static final String MAVEN_USER_SETTINGS = "maven.user.settings";
93
94 /**
95 * Maven project settings.
96 *
97 * @since 4.0.0
98 */
99 @Config(defaultValue = "${maven.project.conf}/settings.xml")
100 public static final String MAVEN_PROJECT_SETTINGS = "maven.project.settings";
101
102 /**
103 * Maven installation extensions.
104 *
105 * @since 4.0.0
106 */
107 @Config(defaultValue = "${maven.installation.conf}/extensions.xml")
108 public static final String MAVEN_INSTALLATION_EXTENSIONS = "maven.installation.extensions";
109
110 /**
111 * Maven user extensions.
112 *
113 * @since 4.0.0
114 */
115 @Config(defaultValue = "${maven.user.conf}/extensions.xml")
116 public static final String MAVEN_USER_EXTENSIONS = "maven.user.extensions";
117
118 /**
119 * Maven project extensions.
120 *
121 * @since 4.0.0
122 */
123 @Config(defaultValue = "${maven.project.conf}/extensions.xml")
124 public static final String MAVEN_PROJECT_EXTENSIONS = "maven.project.extensions";
125
126 /**
127 * Maven installation toolchains.
128 *
129 * @since 4.0.0
130 */
131 @Config(defaultValue = "${maven.installation.conf}/toolchains.xml")
132 public static final String MAVEN_INSTALLATION_TOOLCHAINS = "maven.installation.toolchains";
133
134 /**
135 * Maven user toolchains.
136 *
137 * @since 4.0.0
138 */
139 @Config(defaultValue = "${maven.user.home}/toolchains.xml")
140 public static final String MAVEN_USER_TOOLCHAINS = "maven.user.toolchains";
141
142 /**
143 * Extensions class path.
144 */
145 @Config
146 public static final String MAVEN_EXT_CLASS_PATH = "maven.ext.class.path";
147
148 public static final String MAVEN_STYLE_PREFIX = "maven.style.";
149
150 // Style Names
151 public static final String MAVEN_STYLE_TRANSFER_NAME = "transfer";
152 public static final String MAVEN_STYLE_TRACE_NAME = "trace";
153 public static final String MAVEN_STYLE_DEBUG_NAME = "debug";
154 public static final String MAVEN_STYLE_INFO_NAME = "info";
155 public static final String MAVEN_STYLE_WARNING_NAME = "warning";
156 public static final String MAVEN_STYLE_ERROR_NAME = "error";
157 public static final String MAVEN_STYLE_SUCCESS_NAME = "success";
158 public static final String MAVEN_STYLE_FAILURE_NAME = "failure";
159 public static final String MAVEN_STYLE_STRONG_NAME = "strong";
160 public static final String MAVEN_STYLE_MOJO_NAME = "mojo";
161 public static final String MAVEN_STYLE_PROJECT_NAME = "project";
162
163 // Default Values
164 public static final String MAVEN_STYLE_TRANSFER_DEFAULT = "f:bright-black";
165 public static final String MAVEN_STYLE_TRACE_DEFAULT = "bold,f:magenta";
166 public static final String MAVEN_STYLE_DEBUG_DEFAULT = "bold,f:cyan";
167 public static final String MAVEN_STYLE_INFO_DEFAULT = "bold,f:blue";
168 public static final String MAVEN_STYLE_WARNING_DEFAULT = "bold,f:yellow";
169 public static final String MAVEN_STYLE_ERROR_DEFAULT = "bold,f:red";
170 public static final String MAVEN_STYLE_SUCCESS_DEFAULT = "bold,f:green";
171 public static final String MAVEN_STYLE_FAILURE_DEFAULT = "bold,f:red";
172 public static final String MAVEN_STYLE_STRONG_DEFAULT = "bold";
173 public static final String MAVEN_STYLE_MOJO_DEFAULT = "f:green";
174 public static final String MAVEN_STYLE_PROJECT_DEFAULT = "f:cyan";
175
176 /**
177 * Maven output color mode.
178 * Allowed values are <code>auto</code>, <code>always</code>, <code>never</code>.
179 *
180 * @since 4.0.0
181 */
182 @Config(defaultValue = "auto")
183 public static final String MAVEN_STYLE_COLOR_PROPERTY = MAVEN_STYLE_PREFIX + "color";
184
185 /**
186 * Color style for transfer messages.
187 * @since 4.0.0
188 */
189 @Config(defaultValue = MAVEN_STYLE_TRANSFER_DEFAULT)
190 public static final String MAVEN_STYLE_TRANSFER = MAVEN_STYLE_PREFIX + MAVEN_STYLE_TRANSFER_NAME;
191
192 /**
193 * Color style for trace messages.
194 * @since 4.0.0
195 */
196 @Config(defaultValue = MAVEN_STYLE_TRACE_DEFAULT)
197 public static final String MAVEN_STYLE_TRACE = MAVEN_STYLE_PREFIX + MAVEN_STYLE_TRACE_NAME;
198
199 /**
200 * Color style for debug messages.
201 * @since 4.0.0
202 */
203 @Config(defaultValue = MAVEN_STYLE_DEBUG_DEFAULT)
204 public static final String MAVEN_STYLE_DEBUG = MAVEN_STYLE_PREFIX + MAVEN_STYLE_DEBUG_NAME;
205
206 /**
207 * Color style for info messages.
208 * @since 4.0.0
209 */
210 @Config(defaultValue = MAVEN_STYLE_INFO_DEFAULT)
211 public static final String MAVEN_STYLE_INFO = MAVEN_STYLE_PREFIX + MAVEN_STYLE_INFO_NAME;
212
213 /**
214 * Color style for warning messages.
215 * @since 4.0.0
216 */
217 @Config(defaultValue = MAVEN_STYLE_WARNING_DEFAULT)
218 public static final String MAVEN_STYLE_WARNING = MAVEN_STYLE_PREFIX + MAVEN_STYLE_WARNING_NAME;
219
220 /**
221 * Color style for error messages.
222 * @since 4.0.0
223 */
224 @Config(defaultValue = MAVEN_STYLE_ERROR_DEFAULT)
225 public static final String MAVEN_STYLE_ERROR = MAVEN_STYLE_PREFIX + MAVEN_STYLE_ERROR_NAME;
226
227 /**
228 * Color style for success messages.
229 * @since 4.0.0
230 */
231 @Config(defaultValue = MAVEN_STYLE_SUCCESS_DEFAULT)
232 public static final String MAVEN_STYLE_SUCCESS = MAVEN_STYLE_PREFIX + MAVEN_STYLE_SUCCESS_NAME;
233
234 /**
235 * Color style for failure messages.
236 * @since 4.0.0
237 */
238 @Config(defaultValue = MAVEN_STYLE_FAILURE_DEFAULT)
239 public static final String MAVEN_STYLE_FAILURE = MAVEN_STYLE_PREFIX + MAVEN_STYLE_FAILURE_NAME;
240
241 /**
242 * Color style for strong messages.
243 * @since 4.0.0
244 */
245 @Config(defaultValue = MAVEN_STYLE_STRONG_DEFAULT)
246 public static final String MAVEN_STYLE_STRONG = MAVEN_STYLE_PREFIX + MAVEN_STYLE_STRONG_NAME;
247
248 /**
249 * Color style for mojo messages.
250 * @since 4.0.0
251 */
252 @Config(defaultValue = MAVEN_STYLE_MOJO_DEFAULT)
253 public static final String MAVEN_STYLE_MOJO = MAVEN_STYLE_PREFIX + MAVEN_STYLE_MOJO_NAME;
254
255 /**
256 * Color style for project messages.
257 * @since 4.0.0
258 */
259 @Config(defaultValue = MAVEN_STYLE_PROJECT_DEFAULT)
260 public static final String MAVEN_STYLE_PROJECT = MAVEN_STYLE_PREFIX + MAVEN_STYLE_PROJECT_NAME;
261
262 /**
263 * Build timestamp format.
264 *
265 * @since 3.0.0
266 */
267 @Config(source = Config.Source.MODEL, defaultValue = "yyyy-MM-dd'T'HH:mm:ssXXX")
268 public static final String MAVEN_BUILD_TIMESTAMP_FORMAT = "maven.build.timestamp.format";
269
270 /**
271 * User controlled relocations.
272 * This property is a comma separated list of entries with the syntax <code>GAV>GAV</code>.
273 * The first <code>GAV</code> can contain <code>*</code> for any elem (so <code>*:*:*</code> would mean ALL, something
274 * you don't want). The second <code>GAV</code> is either fully specified, or also can contain <code>*</code>,
275 * then it behaves as "ordinary relocation": the coordinate is preserved from relocated artifact.
276 * Finally, if right hand <code>GAV</code> is absent (line looks like <code>GAV></code>), the left hand matching
277 * <code>GAV</code> is banned fully (from resolving).
278 * <br/>
279 * Note: the <code>></code> means project level, while <code>>></code> means global (whole session level,
280 * so even plugins will get relocated artifacts) relocation.
281 * <br/>
282 * For example,
283 * <pre>maven.relocations.entries = org.foo:*:*>, \\<br/> org.here:*:*>org.there:*:*, \\<br/> javax.inject:javax.inject:1>>jakarta.inject:jakarta.inject:1.0.5</pre>
284 * means: 3 entries, ban <code>org.foo group</code> (exactly, so <code>org.foo.bar</code> is allowed),
285 * relocate <code>org.here</code> to <code>org.there</code> and finally globally relocate (see <code>>></code> above)
286 * <code>javax.inject:javax.inject:1</code> to <code>jakarta.inject:jakarta.inject:1.0.5</code>.
287 *
288 * @since 4.0.0
289 */
290 @Config
291 public static final String MAVEN_RELOCATIONS_ENTRIES = "maven.relocations.entries";
292
293 /**
294 * User property for version filter expression used in session, applied to resolving ranges: a semicolon separated
295 * list of filters to apply. By default, no version filter is applied (like in Maven 3).
296 * <br/>
297 * Supported filters:
298 * <ul>
299 * <li>"h" or "h(num)" - highest version or top list of highest ones filter</li>
300 * <li>"l" or "l(num)" - lowest version or bottom list of lowest ones filter</li>
301 * <li>"s" - contextual snapshot filter</li>
302 * <li>"e(G:A:V)" - predicate filter (leaves out G:A:V from range, if hit, V can be range)</li>
303 * </ul>
304 * Example filter expression: <code>"h(5);s;e(org.foo:bar:1)</code> will cause: ranges are filtered for "top 5" (instead
305 * full range), snapshots are banned if root project is not a snapshot, and if range for <code>org.foo:bar</code> is
306 * being processed, version 1 is omitted. Value in this property builds
307 * <code>org.eclipse.aether.collection.VersionFilter</code> instance.
308 *
309 * @since 4.0.0
310 */
311 @Config
312 public static final String MAVEN_VERSION_FILTER = "maven.session.versionFilter";
313
314 /**
315 * User property for chained LRM: the new "head" local repository to use, and "push" the existing into tail.
316 * Similar to <code>maven.repo.local.tail</code>, this property may contain comma separated list of paths to be
317 * used as local repositories (combine with chained local repository), but while latter is "appending" this
318 * one is "prepending".
319 *
320 * @since 4.0.0
321 */
322 @Config
323 public static final String MAVEN_REPO_LOCAL_HEAD = "maven.repo.local.head";
324
325 /**
326 * User property for chained LRM: list of "tail" local repository paths (separated by comma), to be used with
327 * <code>org.eclipse.aether.util.repository.ChainedLocalRepositoryManager</code>.
328 * Default value: <code>null</code>, no chained LRM is used.
329 *
330 * @since 3.9.0
331 */
332 @Config
333 public static final String MAVEN_REPO_LOCAL_TAIL = "maven.repo.local.tail";
334
335 /**
336 * User property for chained LRM: whether to ignore "availability check" in tail or not. Usually you do want
337 * to ignore it. This property is mapped onto corresponding Resolver 2.x property, is like a synonym for it.
338 * Default value: <code>true</code>.
339 *
340 * @since 3.9.0
341 * @see <a href="https://maven.apache.org/resolver/configuration.html">Resolver Configuration: aether.chainedLocalRepository.ignoreTailAvailability</a>
342 */
343 @Config
344 public static final String MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY = "maven.repo.local.tail.ignoreAvailability";
345
346 /**
347 * User property for reverse dependency tree. If enabled, Maven will record ".tracking" directory into local
348 * repository with "reverse dependency tree", essentially explaining WHY given artifact is present in local
349 * repository.
350 * Default: <code>false</code>, will not record anything.
351 *
352 * @since 3.9.0
353 */
354 @Config(defaultValue = "false")
355 public static final String MAVEN_REPO_LOCAL_RECORD_REVERSE_TREE = "maven.repo.local.recordReverseTree";
356
357 /**
358 * User property for selecting dependency manager behaviour regarding transitive dependencies and dependency
359 * management entries in their POMs. Maven 3 targeted full backward compatibility with Maven2, hence it ignored
360 * dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default, hence
361 * unlike Maven2, obeys dependency management entries deep in dependency graph as well.
362 * <br/>
363 * Default: <code>"true"</code>.
364 *
365 * @since 4.0.0
366 */
367 @Config(defaultValue = "true")
368 public static final String MAVEN_RESOLVER_DEPENDENCY_MANAGER_TRANSITIVITY =
369 "maven.resolver.dependencyManagerTransitivity";
370
371 /**
372 * Resolver transport to use.
373 * Can be <code>default</code>, <code>wagon</code>, <code>apache</code>, <code>jdk</code> or <code>auto</code>.
374 *
375 * @since 4.0.0
376 */
377 @Config(defaultValue = "default")
378 public static final String MAVEN_RESOLVER_TRANSPORT = "maven.resolver.transport";
379
380 /**
381 * Plugin validation level.
382 *
383 * @since 3.9.2
384 */
385 @Config(defaultValue = "inline")
386 public static final String MAVEN_PLUGIN_VALIDATION = "maven.plugin.validation";
387
388 /**
389 * Plugin validation exclusions.
390 *
391 * @since 3.9.6
392 */
393 @Config
394 public static final String MAVEN_PLUGIN_VALIDATION_EXCLUDES = "maven.plugin.validation.excludes";
395
396 /**
397 * ProjectBuilder parallelism.
398 *
399 * @since 4.0.0
400 */
401 @Config(type = "java.lang.Integer", defaultValue = "cores/2 + 1")
402 public static final String MAVEN_MODEL_BUILDER_PARALLELISM = "maven.modelBuilder.parallelism";
403
404 /**
405 * User property for enabling/disabling the consumer POM feature.
406 *
407 * @since 4.0.0
408 */
409 @Config(type = "java.lang.Boolean", defaultValue = "true")
410 public static final String MAVEN_CONSUMER_POM = "maven.consumer.pom";
411
412 /**
413 * User property for disabling version resolver cache.
414 *
415 * @since 3.0.0
416 */
417 @Config(type = "java.lang.Boolean", defaultValue = "false")
418 public static final String MAVEN_VERSION_RESOLVER_NO_CACHE = "maven.versionResolver.noCache";
419
420 /**
421 * User property for overriding calculated "build number" for snapshot deploys. Caution: this property should
422 * be RARELY used (if used at all). It may help in special cases like "aligning" a reactor build subprojects
423 * build numbers to perform a "snapshot lock down". Value given here must be <code>maxRemoteBuildNumber + 1</code>
424 * or greater, otherwise build will fail. How the number to be obtained is left to user (ie by inspecting
425 * snapshot repository metadata or alike).
426 *
427 * Note: this feature is present in Maven 3.9.7 but with different key: <code>maven.buildNumber</code>. In Maven 4
428 * as part of cleanup effort this key was renamed to properly reflect its purpose.
429 *
430 * @since 4.0.0
431 */
432 @Config(type = "java.lang.Integer")
433 public static final String MAVEN_DEPLOY_SNAPSHOT_BUILD_NUMBER = "maven.deploy.snapshot.buildNumber";
434
435 private Constants() {}
436 }