Class CommonsCliUpgradeOptions

java.lang.Object
org.apache.maven.cling.invoker.CommonsCliOptions
org.apache.maven.cling.invoker.mvnup.CommonsCliUpgradeOptions
All Implemented Interfaces:
UpgradeOptions, Options

public class CommonsCliUpgradeOptions extends CommonsCliOptions implements UpgradeOptions
Implementation of UpgradeOptions (base + mvnup).
  • Constructor Details

  • Method Details

    • parse

      public static CommonsCliUpgradeOptions parse(String[] args) throws org.apache.commons.cli.ParseException
      Throws:
      org.apache.commons.cli.ParseException
    • force

      @Nonnull public Optional<Boolean> force()
      Description copied from interface: UpgradeOptions
      Should the operation be forced (ie overwrite existing files, if any).
      Specified by:
      force in interface UpgradeOptions
      Returns:
      an Optional containing the boolean value true if specified, or empty
    • yes

      @Nonnull public Optional<Boolean> yes()
      Description copied from interface: UpgradeOptions
      Should imply "yes" to all questions.
      Specified by:
      yes in interface UpgradeOptions
      Returns:
      an Optional containing the boolean value true if specified, or empty
    • goals

      @Nonnull public Optional<List<String>> goals()
      Description copied from interface: UpgradeOptions
      Returns the list of upgrade goals to be executed. These goals can include operations like "check", "dependencies", "plugins", etc.
      Specified by:
      goals in interface UpgradeOptions
      Returns:
      an Optional containing the list of goals, or empty if not specified
    • modelVersion

      @Nonnull public Optional<String> modelVersion()
      Description copied from interface: UpgradeOptions
      Returns the target POM model version for upgrades. Supported values include "4.0.0" and "4.1.0".
      Specified by:
      modelVersion in interface UpgradeOptions
      Returns:
      an Optional containing the model version, or empty if not specified
    • directory

      @Nonnull public Optional<String> directory()
      Description copied from interface: UpgradeOptions
      Returns the directory to use as starting point for POM discovery. If not specified, the current directory will be used.
      Specified by:
      directory in interface UpgradeOptions
      Returns:
      an Optional containing the directory path, or empty if not specified
    • infer

      @Nonnull public Optional<Boolean> infer()
      Description copied from interface: UpgradeOptions
      Should use inference when upgrading (remove redundant information).
      Specified by:
      infer in interface UpgradeOptions
      Returns:
      an Optional containing the boolean value true if specified, or empty
    • model

      @Nonnull public Optional<Boolean> model()
      Description copied from interface: UpgradeOptions
      Should fix Maven 4 compatibility issues in POMs. This includes fixing unsupported combine attributes, duplicate dependencies, unsupported expressions, and other Maven 4 validation issues.
      Specified by:
      model in interface UpgradeOptions
      Returns:
      an Optional containing the boolean value true if specified, or empty
    • plugins

      @Nonnull public Optional<Boolean> plugins()
      Description copied from interface: UpgradeOptions
      Should upgrade plugins known to fail with Maven 4 to their minimum compatible versions. This includes upgrading plugins like maven-exec-plugin, maven-enforcer-plugin, flatten-maven-plugin, and maven-shade-plugin to versions that work with Maven 4.
      Specified by:
      plugins in interface UpgradeOptions
      Returns:
      an Optional containing the boolean value true if specified, or empty
    • all

      @Nonnull public Optional<Boolean> all()
      Description copied from interface: UpgradeOptions
      Should apply all upgrade options (equivalent to --model-version 4.1.0 --infer --model --plugins). This is a convenience option that combines model upgrade, inference, compatibility fixes, and plugin upgrades.
      Specified by:
      all in interface UpgradeOptions
      Returns:
      an Optional containing the boolean value true if specified, or empty
    • displayHelp

      public void displayHelp(ParserRequest request, Consumer<String> printStream)
      Description copied from interface: Options
      Displays help information for these options.
      Specified by:
      displayHelp in interface Options
      Overrides:
      displayHelp in class CommonsCliOptions
      Parameters:
      printStream - the string consumer to use for output
    • copy

      protected CommonsCliUpgradeOptions copy(String source, CommonsCliOptions.CLIManager cliManager, org.apache.commons.cli.CommandLine commandLine)
      Overrides:
      copy in class CommonsCliOptions