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 /**
149 * Maven output color mode.
150 * Allowed values are <code>auto</code>, <code>always</code>, <code>never</code>.
151 *
152 * @since 4.0.0
153 */
154 @Config(defaultValue = "auto")
155 public static final String MAVEN_STYLE_COLOR_PROPERTY = "maven.style.color";
156
157 /**
158 * Build timestamp format.
159 *
160 * @since 3.0.0
161 */
162 @Config(source = Config.Source.MODEL, defaultValue = "yyyy-MM-dd'T'HH:mm:ssXXX")
163 public static final String MAVEN_BUILD_TIMESTAMP_FORMAT = "maven.build.timestamp.format";
164
165 /**
166 * User controlled relocations.
167 * This property is a comma separated list of entries with the syntax <code>GAV>GAV</code>.
168 * The first <code>GAV</code> can contain <code>*</code> for any elem (so <code>*:*:*</code> would mean ALL, something
169 * you don't want). The second <code>GAV</code> is either fully specified, or also can contain <code>*</code>,
170 * then it behaves as "ordinary relocation": the coordinate is preserved from relocated artifact.
171 * Finally, if right hand <code>GAV</code> is absent (line looks like <code>GAV></code>), the left hand matching
172 * <code>GAV</code> is banned fully (from resolving).
173 * <br/>
174 * Note: the <code>></code> means project level, while <code>>></code> means global (whole session level,
175 * so even plugins will get relocated artifacts) relocation.
176 * <br/>
177 * For example,
178 * <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>
179 * means: 3 entries, ban <code>org.foo group</code> (exactly, so <code>org.foo.bar</code> is allowed),
180 * relocate <code>org.here</code> to <code>org.there</code> and finally globally relocate (see <code>>></code> above)
181 * <code>javax.inject:javax.inject:1</code> to <code>jakarta.inject:jakarta.inject:1.0.5</code>.
182 *
183 * @since 4.0.0
184 */
185 @Config
186 public static final String MAVEN_RELOCATIONS_ENTRIES = "maven.relocations.entries";
187
188 /**
189 * User property for version filters expression, a semicolon separated list of filters to apply. By default, no version
190 * filter is applied (like in Maven 3).
191 * <br/>
192 * Supported filters:
193 * <ul>
194 * <li>"h" or "h(num)" - highest version or top list of highest ones filter</li>
195 * <li>"l" or "l(num)" - lowest version or bottom list of lowest ones filter</li>
196 * <li>"s" - contextual snapshot filter</li>
197 * <li>"e(G:A:V)" - predicate filter (leaves out G:A:V from range, if hit, V can be range)</li>
198 * </ul>
199 * Example filter expression: <code>"h(5);s;e(org.foo:bar:1)</code> will cause: ranges are filtered for "top 5" (instead
200 * full range), snapshots are banned if root project is not a snapshot, and if range for <code>org.foo:bar</code> is
201 * being processed, version 1 is omitted.
202 *
203 * @since 4.0.0
204 */
205 @Config
206 public static final String MAVEN_VERSION_FILTERS = "maven.versionFilters";
207
208 /**
209 * User property for chained LRM: list of "tail" local repository paths (separated by comma), to be used with
210 * {@code org.eclipse.aether.util.repository.ChainedLocalRepositoryManager}.
211 * Default value: <code>null</code>, no chained LRM is used.
212 *
213 * @since 3.9.0
214 */
215 @Config
216 public static final String MAVEN_REPO_LOCAL_TAIL = "maven.repo.local.tail";
217
218 /**
219 * User property for reverse dependency tree. If enabled, Maven will record ".tracking" directory into local
220 * repository with "reverse dependency tree", essentially explaining WHY given artifact is present in local
221 * repository.
222 * Default: <code>false</code>, will not record anything.
223 *
224 * @since 3.9.0
225 */
226 @Config(defaultValue = "false")
227 public static final String MAVEN_REPO_LOCAL_RECORD_REVERSE_TREE = "maven.repo.local.recordReverseTree";
228
229 /**
230 * User property for selecting dependency manager behaviour regarding transitive dependencies and dependency
231 * management entries in their POMs. Maven 3 targeted full backward compatibility with Maven2, hence it ignored
232 * dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default, hence
233 * unlike Maven2, obeys dependency management entries deep in dependency graph as well.
234 * <br/>
235 * Default: <code>"true"</code>.
236 *
237 * @since 4.0.0
238 */
239 @Config(defaultValue = "true")
240 public static final String MAVEN_RESOLVER_DEPENDENCY_MANAGER_TRANSITIVITY =
241 "maven.resolver.dependencyManagerTransitivity";
242
243 /**
244 * Resolver transport to use.
245 * Can be <code>default</code>, <code>wagon</code>, <code>apache</code>, <code>jdk</code> or <code>auto</code>.
246 *
247 * @since 4.0.0
248 */
249 @Config(defaultValue = "default")
250 public static final String MAVEN_RESOLVER_TRANSPORT = "maven.resolver.transport";
251
252 /**
253 * Plugin validation level.
254 *
255 * @since 3.9.2
256 */
257 @Config(defaultValue = "inline")
258 public static final String MAVEN_PLUGIN_VALIDATION = "maven.plugin.validation";
259
260 /**
261 * Plugin validation exclusions.
262 *
263 * @since 3.9.6
264 */
265 @Config
266 public static final String MAVEN_PLUGIN_VALIDATION_EXCLUDES = "maven.plugin.validation.excludes";
267
268 /**
269 * ProjectBuilder parallelism.
270 *
271 * @since 4.0.0
272 */
273 @Config(type = "java.lang.Integer", defaultValue = "cores/2 + 1")
274 public static final String MAVEN_PROJECT_BUILDER_PARALLELISM = "maven.projectBuilder.parallelism";
275
276 private Constants() {}
277 }