1 package org.apache.maven.shared.invoker;
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.io.File;
23 import java.io.InputStream;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.Properties;
27
28 /**
29 * Specifies the parameters used to control a Maven invocation.
30 *
31 */
32 public interface InvocationRequest
33 {
34
35 /**
36 * By default, Maven is executed in batch mode. This mean no interaction with the Maven process can be done.
37 *
38 * @return <code>true</code> if Maven should be executed in batch mode, <code>false</code> if Maven is executed in
39 * interactive mode.
40 * @since 3.0.0
41 */
42 boolean isBatchMode();
43
44 /**
45 * Gets the network mode of the Maven invocation. By default, Maven is executed in online mode.
46 *
47 * @return <code>true</code> if Maven should be executed in offline mode, <code>false</code> if the online mode is
48 * used.
49 */
50 boolean isOffline();
51
52 /**
53 * Indicates whether Maven should enforce an update check for plugins and snapshots. By default, no update check is
54 * performed.
55 *
56 * @return <code>true</code> if plugins and snapshots should be updated, <code>false</code> otherwise.
57 */
58 boolean isUpdateSnapshots();
59
60 /**
61 * Gets the recursion behavior of a reactor invocation. By default, Maven will recursive the build into sub modules.
62 *
63 * @return <code>true</code> if sub modules should be build, <code>false</code> otherwise.
64 */
65 boolean isRecursive();
66
67 /**
68 * A list of specified reactor projects to build instead of all projects. A project can be specified by
69 * [groupId]:artifactId or by its relative path.
70 *
71 * @return the list of projects to add to reactor build, otherwise {@code null}
72 * @since 2.1
73 */
74 List<String> getProjects();
75
76 /**
77 * Get the value of the {@code also-make} argument.
78 *
79 * @return {@code true} if the argument {@code also-make} was specified, otherwise {@code false}
80 * @since 2.1
81 */
82 boolean isAlsoMake();
83
84 /**
85 * Get the value of the {@code also-make-dependents}
86 *
87 * @return {@code true} if the argument {@code also-make-dependents} was specified, otherwise {@code false}
88 * @since 2.1
89 */
90 boolean isAlsoMakeDependents();
91
92 /**
93 * Get the value of {@code resume-from}
94 *
95 * @return specified reactor project to resume from
96 * @since 2.1
97 */
98 String getResumeFrom();
99
100 /**
101 * Gets the debug mode of the Maven invocation. By default, Maven is executed in normal mode.
102 *
103 * @return <code>true</code> if Maven should be executed in debug mode, <code>false</code> if the normal mode should
104 * be used.
105 */
106 boolean isDebug();
107
108 /**
109 * Gets the exception output mode of the Maven invocation. By default, Maven will not print stack traces of build
110 * exceptions.
111 *
112 * @return <code>true</code> if Maven should print stack traces, <code>false</code> otherwise.
113 */
114 boolean isShowErrors();
115
116 /**
117 * Indicates whether the environment variables of the current process should be propagated to the Maven invocation.
118 * By default, the current environment variables are inherited by the new Maven invocation.
119 *
120 * @return <code>true</code> if the environment variables should be propagated, <code>false</code> otherwise.
121 */
122 boolean isShellEnvironmentInherited();
123
124 /**
125 * Indicates whether Maven should check for plugin updates. By default, plugin updates are not suppressed.
126 *
127 * @return <code>true</code> if plugin updates should be suppressed, <code>false</code> otherwise.
128 */
129 boolean isNonPluginUpdates();
130
131 /**
132 * Gets the failure mode of the Maven invocation. By default, the mode {@link ReactorFailureBehavior#FailFast} is
133 * used.
134 *
135 * @return The failure mode, one of {@link ReactorFailureBehavior#FailFast},
136 * {@link ReactorFailureBehavior#FailAtEnd} and {@link ReactorFailureBehavior#FailNever}.
137 * @since 3.0.0
138 */
139 ReactorFailureBehavior getReactorFailureBehavior();
140
141 /**
142 * Gets the path to the base directory of the local repository to use for the Maven invocation.
143 *
144 * @param defaultDirectory The default location to use if no location is configured for this request, may be
145 * <code>null</code>.
146 * @return The path to the base directory of the local repository or <code>null</code> to use the location from the
147 * <code>settings.xml</code>.
148 */
149 File getLocalRepositoryDirectory( File defaultDirectory );
150
151 /**
152 * Gets the input stream used to provide input for the invoked Maven build. This is in particular useful when
153 * invoking Maven in interactive mode.
154 *
155 * @param defaultStream the default {@link java.io.InputStream} to use
156 * @return The input stream used to provide input for the invoked Maven build or <code>null</code> if not set.
157 */
158 InputStream getInputStream( InputStream defaultStream );
159
160 /**
161 * Gets the handler used to capture the standard output from the Maven build.
162 *
163 * @param defaultHandler the default {@link org.apache.maven.shared.invoker.InvocationOutputHandler} to use
164 * @return The output handler or <code>null</code> if not set.
165 */
166 InvocationOutputHandler getOutputHandler( InvocationOutputHandler defaultHandler );
167
168 /**
169 * Gets the handler used to capture the error output from the Maven build.
170 *
171 * @param defaultHandler the default {@link org.apache.maven.shared.invoker.InvocationOutputHandler} to use
172 * @return The error handler or <code>null</code> if not set.
173 */
174 InvocationOutputHandler getErrorHandler( InvocationOutputHandler defaultHandler );
175
176 /**
177 * Gets the path to the POM for the Maven invocation. If no base directory is set, the parent directory of this POM
178 * will be used as the working directory for the Maven invocation.
179 *
180 * @return The path to the POM for the Maven invocation or <code>null</code> if not set.
181 */
182 File getPomFile();
183
184 /**
185 * Gets the (unqualified) filename of the POM for the Maven invocation. This setting is ignored if
186 * {@link #getPomFile()} does not return <code>null</code>. Otherwise, the base directory is assumed to contain a
187 * POM with this name. By default, a file named <code>pom.xml</code> is used.
188 *
189 * @return The (unqualified) filename of the POM for the Maven invocation or <code>null</code> if not set.
190 */
191 String getPomFileName();
192
193 /**
194 * List of raw line arguments which will be passed to cli.
195 *
196 * @return a list of cli arguments
197 * @since 3.2.0
198 */
199 List<String> getArgs();
200
201 /**
202 * Gets the path to the base directory of the POM for the Maven invocation. If {@link #getPomFile()} does not return
203 * <code>null</code>, this setting only affects the working directory for the Maven invocation.
204 *
205 * @return The path to the base directory of the POM or <code>null</code> if not set.
206 */
207 File getBaseDirectory();
208
209 /**
210 * Gets the path to the base directory of the POM for the Maven invocation. If {@link #getPomFile()} does not return
211 * <code>null</code>, this setting only affects the working directory for the Maven invocation.
212 *
213 * @param defaultDirectory The default base directory to use if none is configured for this request, may be
214 * <code>null</code>.
215 * @return The path to the base directory of the POM or <code>null</code> if not set.
216 */
217 File getBaseDirectory( File defaultDirectory );
218
219 /**
220 * Gets the path to the base directory of the Java installation used to run Maven.
221 *
222 * @return The path to the base directory of the Java installation used to run Maven or <code>null</code> to use the
223 * default Java home.
224 */
225 File getJavaHome();
226
227 /**
228 * Gets the system properties for the Maven invocation.
229 *
230 * @return The system properties for the Maven invocation or <code>null</code> if not set.
231 */
232 Properties getProperties();
233
234 /**
235 * Gets the goals for the Maven invocation.
236 *
237 * @return The goals for the Maven invocation or <code>null</code> if not set.
238 */
239 List<String> getGoals();
240
241 /**
242 * Gets the path to the user settings for the Maven invocation.
243 *
244 * @return The path to the user settings for the Maven invocation or <code>null</code> to load the user settings
245 * from the default location.
246 */
247 File getUserSettingsFile();
248
249 /**
250 * Gets the path to the global settings for the Maven invocation.
251 *
252 * @return The path to the global settings for the Maven invocation or <code>null</code> to load the global settings
253 * from the default location.
254 * @since 2.1
255 */
256 File getGlobalSettingsFile();
257
258 /**
259 * Gets the path to the custom toolchains file
260 *
261 * @return The path to the custom toolchains file or <code>null</code> to load the toolchains from the default
262 * location
263 * @since 2.1
264 */
265 File getToolchainsFile();
266
267 /**
268 * Alternate path for the global toolchains file <b>Note. This is available since Maven 3.3.1</b>
269 *
270 * @return The path to the custom global toolchains file or <code>null</code> to load the global toolchains from the
271 * default location.
272 * @since 3.0.0
273 */
274 File getGlobalToolchainsFile();
275
276 /**
277 * Gets the checksum mode of the Maven invocation.
278 *
279 * @return The checksum mode, one of {@link CheckSumPolicy#Warn} and {@link CheckSumPolicy#Fail}.
280 * @since 3.0.0
281 */
282 CheckSumPolicy getGlobalChecksumPolicy();
283
284 /**
285 * Gets the profiles for the Maven invocation.
286 *
287 * @return The profiles for the Maven invocation or <code>null</code> if not set.
288 */
289 List<String> getProfiles();
290
291 /**
292 * Gets the environment variables for the Maven invocation.
293 *
294 * @return The environment variables for the Maven invocation or <code>null</code> if not set.
295 */
296 Map<String, String> getShellEnvironments();
297
298 /**
299 * Gets the value of the <code>MAVEN_OPTS</code> environment variable.
300 *
301 * @return The value of the <code>MAVEN_OPTS</code> environment variable or <code>null</code> if not set.
302 */
303 String getMavenOpts();
304
305 /**
306 * The show version behavior (-V option)
307 *
308 * @return The show version behavior
309 * @since 2.0.11
310 */
311 boolean isShowVersion();
312
313 /**
314 * Get the value of the {@code threads} argument.
315 *
316 * @return the value of the {@code threads} argument or {@code null} if not set
317 * @since 2.1
318 */
319 String getThreads();
320
321 /**
322 * Gets the quiet mode of the Maven invocation. By default, Maven is executed in normal mode.
323 *
324 * @return <code>true</code> if Maven should be executed in quiet mode, <code>false</code> if normal mode should
325 * be used.
326 * @since 3.1.0
327 */
328 boolean isQuiet();
329
330 /**
331 * Get the value of the {@code no-transfer-progress} argument.
332 *
333 * @return {@code true} if the argument {@code no-transfer-progress} was specified, otherwise {@code false}
334 * @since 3.2.0
335 */
336 boolean isNoTransferProgress();
337
338 // ----------------------------------------------------------------------
339 // Reactor Failure Mode
340 // ----------------------------------------------------------------------
341
342 /**
343 * The reactor failure behavior which to be used during Maven invocation.
344 */
345 enum ReactorFailureBehavior
346 {
347 /**
348 * Stop at first failure in reactor builds
349 */
350 FailFast( "ff", "fail-fast" ),
351 /**
352 * Only fail the build afterwards. allow all non-impacted builds to continue.
353 */
354 FailAtEnd( "fae", "fail-at-end" ),
355 /**
356 * <b>NEVER</b> fail the build, regardless of project result
357 */
358 FailNever( "fn", "fail-never" );
359
360 private String shortOption;
361
362 private String longOption;
363
364 ReactorFailureBehavior( String shortOption, String longOption )
365 {
366 this.shortOption = shortOption;
367 this.longOption = longOption;
368 }
369
370 public String getShortOption()
371 {
372 return this.shortOption;
373 }
374
375 public String getLongOption()
376 {
377 return this.longOption;
378 }
379
380 /**
381 * Returns the enumeration type which is related to the given long option.
382 *
383 * @param longOption The type which is searched for.
384 * @return The appropriate {@link ReactorFailureBehavior}
385 * @throws IllegalArgumentException in case of an long option which does not exists.
386 */
387 public static ReactorFailureBehavior valueOfByLongOption( String longOption )
388 {
389 for ( ReactorFailureBehavior item : ReactorFailureBehavior.values() )
390 {
391 if ( item.getLongOption().equals( longOption ) )
392 {
393 return item;
394 }
395 }
396 throw new IllegalArgumentException( "The string '" + longOption
397 + "' can not be converted to enumeration." );
398 }
399 }
400
401 // ----------------------------------------------------------------------
402 // Artifact repository policies
403 // ----------------------------------------------------------------------
404
405 /**
406 * The kind of checksum policy which should be used during Maven invocation.
407 */
408 enum CheckSumPolicy
409 {
410
411 /**
412 * Strict checksum checking equivalent of {@code --strict-checksums}
413 */
414 Fail,
415 /**
416 * Warn checksum failures equivalent {@code --lax-checksums}.
417 */
418 Warn;
419
420 }
421
422 // ----------------------------------------------------------------------
423 //
424 // ----------------------------------------------------------------------
425
426 /**
427 * Sets the interaction mode of the Maven invocation. Equivalent of {@code -B} and {@code --batch-mode}
428 *
429 * @param batchMode <code>true</code> if Maven should be executed in non-interactive mode, <code>false</code> if the
430 * interactive modes is used.
431 * @return This invocation request.
432 * @since 3.0.0
433 */
434 InvocationRequest setBatchMode( boolean batchMode );
435
436 /**
437 * Sets the network mode of the Maven invocation. Equivalent of {@code -o} and {@code --offline}
438 *
439 * @param offline <code>true</code> if Maven should be executed in offline mode, <code>false</code> if the online
440 * mode is used.
441 * @return This invocation request.
442 */
443 InvocationRequest setOffline( boolean offline );
444
445 /**
446 * Sets the debug mode of the Maven invocation. Equivalent of {@code -X} and {@code --debug}
447 *
448 * @param debug <code>true</code> if Maven should be executed in debug mode, <code>false</code> if the normal mode
449 * should be used.
450 * @return This invocation request.
451 */
452 InvocationRequest setDebug( boolean debug );
453
454 /**
455 * Sets the exception output mode of the Maven invocation. Equivalent of {@code -e} and {@code --errors}
456 *
457 * @param showErrors <code>true</code> if Maven should print stack traces, <code>false</code> otherwise.
458 * @return This invocation request.
459 */
460 InvocationRequest setShowErrors( boolean showErrors );
461
462 /**
463 * Specifies whether Maven should enforce an update check for plugins and snapshots. Equivalent of {@code -U} and
464 * {@code --update-snapshots}
465 *
466 * @param updateSnapshots <code>true</code> if plugins and snapshots should be updated, <code>false</code>
467 * otherwise.
468 * @return This invocation request.
469 */
470 InvocationRequest setUpdateSnapshots( boolean updateSnapshots );
471
472 /**
473 * Sets the failure mode of the Maven invocation. Equivalent of {@code -ff} and {@code --fail-fast}, {@code -fae}
474 * and {@code --fail-at-end}, {@code -fn} and {@code --fail-never}
475 *
476 * @param failureBehavior The failure mode, must be one of {@link ReactorFailureBehavior#FailFast},
477 * {@link ReactorFailureBehavior#FailAtEnd} and {@link ReactorFailureBehavior#FailNever}.
478 * @return This invocation request.
479 * @since 3.0.0
480 */
481 InvocationRequest setReactorFailureBehavior( ReactorFailureBehavior failureBehavior );
482
483 /**
484 * Sets the path to the base directory of the local repository to use for the Maven invocation.
485 *
486 * @param localRepository The path to the base directory of the local repository, may be <code>null</code>.
487 * @return This invocation request.
488 */
489 InvocationRequest setLocalRepositoryDirectory( File localRepository );
490
491 /**
492 * Sets the input stream used to provide input for the invoked Maven build. This is in particular useful when
493 * invoking Maven in interactive mode.
494 *
495 * @param inputStream The input stream used to provide input for the invoked Maven build, may be <code>null</code>
496 * if not required.
497 * @return This invocation request.
498 */
499 InvocationRequest setInputStream( InputStream inputStream );
500
501 /**
502 * Sets the handler used to capture the standard output from the Maven build.
503 *
504 * @param outputHandler The output handler, may be <code>null</code> if the output is not of interest.
505 * @return This invocation request.
506 */
507 InvocationRequest setOutputHandler( InvocationOutputHandler outputHandler );
508
509 /**
510 * Sets the handler used to capture the error output from the Maven build.
511 *
512 * @param errorHandler The error handler, may be <code>null</code> if the output is not of interest.
513 * @return This invocation request.
514 */
515 InvocationRequest setErrorHandler( InvocationOutputHandler errorHandler );
516
517 /**
518 * Sets the path to the POM for the Maven invocation. If no base directory is set, the parent directory of this POM
519 * will be used as the working directory for the Maven invocation.
520 *
521 * @param pomFile The path to the POM for the Maven invocation, may be <code>null</code> if not used.
522 * @return This invocation request.
523 */
524 InvocationRequest setPomFile( File pomFile );
525
526 /**
527 * Sets the (unqualified) filename of the POM for the Maven invocation. This setting is ignored if
528 * {@link #getPomFile()} does not return <code>null</code>. Otherwise, the base directory is assumed to contain a
529 * POM with this name.
530 *
531 * @param pomFilename The (unqualified) filename of the POM for the Maven invocation, may be <code>null</code> if
532 * not used.
533 * @return This invocation request.
534 */
535 InvocationRequest setPomFileName( String pomFilename );
536
537 /**
538 * Add a raw argument to Maven cli command at the end of other arguments.
539 * Can be called multiple time in order to add many arguments.
540 *
541 * @param arg a raw Maven arg line
542 * @return This invocation request.
543 * @since 3.2.0
544 */
545 InvocationRequest addArg( String arg );
546
547 /**
548 * Sets the path to the base directory of the POM for the Maven invocation. If {@link #getPomFile()} does not return
549 * <code>null</code>, this setting only affects the working directory for the Maven invocation.
550 *
551 * @param basedir The path to the base directory of the POM, may be <code>null</code> if not used.
552 * @return This invocation request.
553 */
554 InvocationRequest setBaseDirectory( File basedir );
555
556 /**
557 * Sets the path to the base directory of the Java installation used to run Maven.
558 *
559 * @param javaHome The path to the base directory of the Java installation used to run Maven, may be
560 * <code>null</code> to use the default Java home.
561 * @return This invocation request.
562 */
563 InvocationRequest setJavaHome( File javaHome );
564
565 /**
566 * Sets the system properties for the Maven invocation.
567 *
568 * @param properties The system properties for the Maven invocation, may be <code>null</code> if not set.
569 * @return This invocation request.
570 */
571 InvocationRequest setProperties( Properties properties );
572
573 /**
574 * Sets the goals for the Maven invocation.
575 *
576 * @param goals The goals for the Maven invocation, may be <code>null</code> to execute the POMs default goal.
577 * @return This invocation request.
578 */
579 InvocationRequest setGoals( List<String> goals );
580
581 /**
582 * Sets the profiles for the Maven invocation. Equivalent of {@code -P} and {@code --active-profiles}
583 *
584 * @param profiles The profiles for the Maven invocation, may be <code>null</code> to use the default profiles.
585 * @return This invocation request.
586 */
587 InvocationRequest setProfiles( List<String> profiles );
588
589 /**
590 * Specifies whether the environment variables of the current process should be propagated to the Maven invocation.
591 *
592 * @param shellEnvironmentInherited <code>true</code> if the environment variables should be propagated,
593 * <code>false</code> otherwise.
594 * @return This invocation request.
595 */
596 InvocationRequest setShellEnvironmentInherited( boolean shellEnvironmentInherited );
597
598 /**
599 * Sets the path to the user settings for the Maven invocation. Equivalent of {@code -s} and {@code --settings}
600 *
601 * @param userSettings The path to the user settings for the Maven invocation, may be <code>null</code> to load the
602 * user settings from the default location.
603 * @return This invocation request.
604 */
605 InvocationRequest setUserSettingsFile( File userSettings );
606
607 /**
608 * Sets the path to the global settings for the Maven invocation. Equivalent of {@code -gs} and
609 * {@code --global-settings}
610 *
611 * @param globalSettings The path to the global settings for the Maven invocation, may be <code>null</code> to load
612 * the global settings from the default location.
613 * @return This invocation request.
614 * @since 2.1
615 */
616 InvocationRequest setGlobalSettingsFile( File globalSettings );
617
618 /**
619 * Sets the alternate path for the user toolchains file Equivalent of {@code -t} or {@code --toolchains}
620 *
621 * @param toolchains the alternate path for the user toolchains file
622 * @return This invocation request
623 * @since 2.1
624 */
625 InvocationRequest setToolchainsFile( File toolchains );
626
627 /**
628 * Sets the alternate path for the global toolchains file Equivalent of {@code -gt} or {@code --global-toolchains}
629 *
630 * @param toolchains the alternate path for the global toolchains file
631 * @return This invocation request
632 * @since 3.0.0
633 */
634 InvocationRequest setGlobalToolchainsFile( File toolchains );
635
636 /**
637 * Sets the checksum mode of the Maven invocation. Equivalent of {@code -c} or {@code --lax-checksums}, {@code -C}
638 * or {@code --strict-checksums}
639 *
640 * @param globalChecksumPolicy The checksum mode, must be one of {@link CheckSumPolicy#Warn} and
641 * {@link CheckSumPolicy#Fail}.
642 * @return This invocation request.
643 * @since 3.0.0
644 */
645 InvocationRequest setGlobalChecksumPolicy( CheckSumPolicy globalChecksumPolicy );
646
647 /**
648 * Specifies whether Maven should check for plugin updates.
649 * <p>
650 * Equivalent of {@code -npu} or {@code --no-plugin-updates}
651 * </p>
652 * <p>
653 * <strong>note: </strong>Ineffective with Maven3, only kept for backward compatibility
654 * </p>
655 *
656 * @param nonPluginUpdates <code>true</code> if plugin updates should be suppressed, <code>false</code> otherwise.
657 * @return This invocation request.
658 */
659 InvocationRequest setNonPluginUpdates( boolean nonPluginUpdates );
660
661 /**
662 * Sets the recursion behavior of a reactor invocation. <em>Inverse</em> equivalent of {@code -N} and
663 * {@code --non-recursive}
664 *
665 * @param recursive <code>true</code> if sub modules should be build, <code>false</code> otherwise.
666 * @return This invocation request.
667 */
668 InvocationRequest setRecursive( boolean recursive );
669
670 /**
671 * Adds the specified environment variable to the Maven invocation.
672 *
673 * @param name The name of the environment variable, must not be <code>null</code>.
674 * @param value The value of the environment variable, must not be <code>null</code>.
675 * @return This invocation request.
676 */
677 InvocationRequest addShellEnvironment( String name, String value );
678
679 /**
680 * Sets the value of the <code>MAVEN_OPTS</code> environment variable.
681 *
682 * @param mavenOpts The value of the <code>MAVEN_OPTS</code> environment variable, may be <code>null</code> to use
683 * the default options.
684 * @return This invocation request.
685 */
686 InvocationRequest setMavenOpts( String mavenOpts );
687
688 /**
689 * enable displaying version without stopping the build Equivalent of {@code -V} or {@code --show-version}
690 *
691 * @param showVersion enable displaying version
692 * @return This invocation request.
693 * @since 2.0.11
694 */
695 InvocationRequest setShowVersion( boolean showVersion );
696
697 /**
698 * Thread count, for instance 2.0C where C is core multiplied Equivalent of {@code -T} or {@code --threads}
699 * <p>
700 * <strong>note: </strong>available since Maven3
701 * </p>
702 *
703 * @param threads the threadcount
704 * @return This invocation request.
705 * @since 2.1
706 */
707 InvocationRequest setThreads( String threads );
708
709 /**
710 * Sets the reactor project list. Equivalent of {@code -pl} or {@code --projects}
711 *
712 * @param projects the reactor project list
713 * @return This invocation request.
714 * @since 2.1
715 */
716 InvocationRequest setProjects( List<String> projects );
717
718 /**
719 * Enable the 'also make' mode. Equivalent of {@code -am} or {@code --also-make}
720 *
721 * @param alsoMake enable 'also make' mode
722 * @return This invocation request.
723 * @since 2.1
724 */
725 InvocationRequest setAlsoMake( boolean alsoMake );
726
727 /**
728 * Enable the 'also make dependents' mode. Equivalent of {@code -amd} or {@code --also-make-dependents}
729 *
730 * @param alsoMakeDependents enable 'also make' mode
731 * @return This invocation request.
732 * @since 2.1
733 */
734 InvocationRequest setAlsoMakeDependents( boolean alsoMakeDependents );
735
736 /**
737 * Resume reactor from specified project. Equivalent of {@code -rf} or {@code --resume-from}
738 *
739 * @param resumeFrom set the project to resume from
740 * @return This invocation request
741 * @since 2.1
742 */
743 InvocationRequest setResumeFrom( String resumeFrom );
744
745 /**
746 * The id of the build strategy to use. equivalent of {@code -b id} or {@code --builder id}.
747 * <b>Note. This is available since Maven 3.2.1</b>
748 *
749 * @param id The builder id.
750 * @return {@link InvocationRequest}
751 * @since 3.0.0
752 */
753 InvocationRequest setBuilder( String id );
754
755 /**
756 * Sets the quiet mode of the Maven invocation. Equivalent of {@code -q} and {@code --quiet}
757 *
758 * @param quiet <code>true</code> if Maven should be executed in quiet mode, <code>false</code> if the normal mode
759 * should be used.
760 * @return This invocation request.
761 * @since 3.1.0
762 */
763 InvocationRequest setQuiet( boolean quiet );
764
765 /**
766 * Enable no transfer progress mode. Equivalent of {@code -ntp} or {@code --no-transfer-progress}
767 * @param noTransferProgress enable no transfer progress mode
768 * @return This invocation request.
769 * @since 3.2.0
770 */
771 InvocationRequest setNoTransferProgress( boolean noTransferProgress );
772
773 /**
774 * Get the current set builder strategy id equivalent of {@code --builder id}. <b>Note. This is available since
775 * Maven 3.2.1</b>
776 *
777 * @return The current set builder id.
778 * @since 3.0.0
779 */
780 String getBuilder();
781
782 /** Constant <code>NO_TIMEOUT=0</code> */
783 int NO_TIMEOUT = 0;
784 /**
785 * <p>getTimeoutInSeconds.</p>
786 *
787 * @since 3.0.1
788 * @return the timeout in seconds to execute the project
789 */
790 int getTimeoutInSeconds();
791
792 /**
793 * <p>setTimeoutInSeconds.</p>
794 *
795 * @since 3.0.1
796 * @param timeoutInSeconds the timeout in seconds to execute the project
797 */
798 void setTimeoutInSeconds( int timeoutInSeconds );
799
800 /**
801 * Gets the path to the base directory of the Maven installation used to invoke Maven.
802 *
803 * @return The path to the base directory of the Maven installation or <code>null</code> if using the default
804 * Maven installation.
805 *
806 * @since 3.2.0
807 */
808 File getMavenHome();
809
810 /**
811 * Sets the path to the base directory of the Maven installation used to invoke Maven. This parameter may be left
812 * unspecified to use the default Maven installation which will be discovered by evaluating the system property
813 * <code>maven.home</code>.
814 *
815 * @param mavenHome The path to the base directory of the Maven installation, may be <code>null</code> to use the
816 * default Maven installation.
817 * @return This invocation request
818 *
819 * @since 3.2.0
820 */
821 InvocationRequest setMavenHome( File mavenHome );
822
823 /**
824 * Get the customized File of the Maven executable.
825 *
826 * @return the custom Maven executable, otherwise {@code null}
827 *
828 * @since 3.2.0
829 */
830 File getMavenExecutable();
831
832 /**
833 * {@code mavenExecutable} can either be a file relative to ${maven.home}/bin/ or an absolute file.
834 *
835 * @param mavenExecutable the executable
836 * @return This invocation request
837 *
838 * @since 3.2.0
839 */
840 InvocationRequest setMavenExecutable( File mavenExecutable );
841 }