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.cli.mvn;
20
21 import java.util.List;
22 import java.util.Optional;
23
24 import org.apache.maven.api.annotations.Experimental;
25 import org.apache.maven.api.annotations.Nonnull;
26 import org.apache.maven.api.cli.Options;
27
28 /**
29 * Defines the options specific to Maven operations.
30 * This interface extends the general {@link Options} interface, adding Maven-specific configuration options.
31 *
32 * <p>These options represent the various flags and settings available through the Maven CLI,
33 * as well as those that can be specified in the {@code maven.config} file. They provide fine-grained
34 * control over Maven's behavior during the build process.</p>
35 *
36 * @since 4.0.0
37 */
38 @Experimental
39 public interface MavenOptions extends Options {
40
41 /**
42 * Returns the path to an alternate POM file.
43 *
44 * @return an {@link Optional} containing the path to the alternate POM file, or empty if not specified
45 */
46 @Nonnull
47 Optional<String> alternatePomFile();
48
49 /**
50 * Indicates whether Maven should operate in non-recursive mode (i.e., not build child modules).
51 *
52 * @return an {@link Optional} containing true if non-recursive mode is enabled, false if disabled, or empty if not specified
53 */
54 @Nonnull
55 Optional<Boolean> nonRecursive();
56
57 /**
58 * Indicates whether Maven should force a check for updated snapshots on remote repositories.
59 *
60 * @return an {@link Optional} containing true if snapshot updates should be forced, false if not, or empty if not specified
61 */
62 @Nonnull
63 Optional<Boolean> updateSnapshots();
64
65 /**
66 * Returns the list of profiles to activate.
67 *
68 * @return an {@link Optional} containing the list of profile names to activate, or empty if not specified
69 */
70 @Nonnull
71 Optional<List<String>> activatedProfiles();
72
73 /**
74 * Indicates whether Maven should suppress SNAPSHOT updates.
75 *
76 * @return an {@link Optional} containing true if SNAPSHOT updates should be suppressed, false if not, or empty if not specified
77 */
78 @Nonnull
79 Optional<Boolean> suppressSnapshotUpdates();
80
81 /**
82 * Indicates whether Maven should use strict checksum verification.
83 *
84 * @return an {@link Optional} containing true if strict checksum verification is enabled, false if not, or empty if not specified
85 */
86 @Nonnull
87 Optional<Boolean> strictChecksums();
88
89 /**
90 * Indicates whether Maven should use relaxed checksum verification.
91 *
92 * @return an {@link Optional} containing true if relaxed checksum verification is enabled, false if not, or empty if not specified
93 */
94 @Nonnull
95 Optional<Boolean> relaxedChecksums();
96
97 /**
98 * Indicates whether Maven should stop at the first failure in a multi-module build.
99 *
100 * @return an {@link Optional} containing true if Maven should stop at the first failure, false if not, or empty if not specified
101 */
102 @Nonnull
103 Optional<Boolean> failFast();
104
105 /**
106 * Indicates whether Maven should run all builds but defer error reporting to the end.
107 *
108 * @return an {@link Optional} containing true if error reporting should be deferred to the end, false if not, or empty if not specified
109 */
110 @Nonnull
111 Optional<Boolean> failAtEnd();
112
113 /**
114 * Indicates whether Maven should never fail the build, regardless of project result.
115 *
116 * @return an {@link Optional} containing true if the build should never fail, false if it should fail normally, or empty if not specified
117 */
118 @Nonnull
119 Optional<Boolean> failNever();
120
121 /**
122 * Indicates whether Maven should resume from the last failed project in a previous build.
123 *
124 * @return an {@link Optional} containing true if Maven should resume from the last failure, false if not, or empty if not specified
125 */
126 @Nonnull
127 Optional<Boolean> resume();
128
129 /**
130 * Returns the project to resume the build from.
131 *
132 * @return an {@link Optional} containing the project name to resume from, or empty if not specified
133 */
134 @Nonnull
135 Optional<String> resumeFrom();
136
137 /**
138 * Returns the list of specified reactor projects to build instead of all projects.
139 *
140 * @return an {@link Optional} containing the list of project names to build, or empty if not specified
141 */
142 @Nonnull
143 Optional<List<String>> projects();
144
145 /**
146 * Indicates whether Maven should also build the specified projects' dependencies.
147 *
148 * @return an {@link Optional} containing true if dependencies should also be built, false if not, or empty if not specified
149 */
150 @Nonnull
151 Optional<Boolean> alsoMake();
152
153 /**
154 * Indicates whether Maven should also build the specified projects' dependents.
155 *
156 * @return an {@link Optional} containing true if dependents should also be built, false if not, or empty if not specified
157 */
158 @Nonnull
159 Optional<Boolean> alsoMakeDependents();
160
161 /**
162 * Returns the number of threads used for parallel builds.
163 *
164 * @return an {@link Optional} containing the number of threads (or "1C" for one thread per CPU core), or empty if not specified
165 */
166 @Nonnull
167 Optional<String> threads();
168
169 /**
170 * Returns the id of the build strategy to use.
171 *
172 * @return an {@link Optional} containing the id of the build strategy, or empty if not specified
173 */
174 @Nonnull
175 Optional<String> builder();
176
177 /**
178 * Indicates whether Maven should not display transfer progress when downloading or uploading.
179 *
180 * @return an {@link Optional} containing true if transfer progress should not be displayed, false if it should, or empty if not specified
181 */
182 @Nonnull
183 Optional<Boolean> noTransferProgress();
184
185 /**
186 * Indicates whether Maven should cache the "not found" status of artifacts that were not found in remote repositories.
187 *
188 * @return an {@link Optional} containing true if "not found" status should be cached, false if not, or empty if not specified
189 */
190 @Nonnull
191 Optional<Boolean> cacheArtifactNotFound();
192
193 /**
194 * Indicates whether Maven should use strict artifact descriptor policy.
195 *
196 * @return an {@link Optional} containing true if strict artifact descriptor policy should be used, false if not, or empty if not specified
197 */
198 @Nonnull
199 Optional<Boolean> strictArtifactDescriptorPolicy();
200
201 /**
202 * Indicates whether Maven should ignore transitive repositories.
203 *
204 * @return an {@link Optional} containing true if transitive repositories should be ignored, false if not, or empty if not specified
205 */
206 @Nonnull
207 Optional<Boolean> ignoreTransitiveRepositories();
208
209 /**
210 * Specifies "@file"-like file, to load up command line from. It may contain goals as well. Format is one parameter
211 * per line (similar to {@code maven.conf}) and {@code '#'} (hash) marked comment lines are allowed. Goals, if
212 * present, are appended, to those specified on CLI input, if any.
213 */
214 Optional<String> atFile();
215
216 /**
217 * Returns the list of goals and phases to execute.
218 *
219 * @return an {@link Optional} containing the list of goals and phases to execute, or empty if not specified
220 */
221 @Nonnull
222 Optional<List<String>> goals();
223 }