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