Example usage for org.apache.maven.cli CLIManager VERSION

List of usage examples for org.apache.maven.cli CLIManager VERSION

Introduction

In this page you can find the example usage for org.apache.maven.cli CLIManager VERSION.

Prototype

char VERSION

To view the source code for org.apache.maven.cli CLIManager VERSION.

Click Source Link

Usage

From source file:org.commonjava.emb.boot.main.EMBCLIManager.java

License:Apache License

@SuppressWarnings("static-access")
private void populateNativeMavenOptions(final Options options) {
    options.addOption(OptionBuilder.withLongOpt("file").hasArg()
            .withDescription("Force the use of an alternate POM file.").create(CLIManager.ALTERNATE_POM_FILE));

    options.addOption(OptionBuilder.withLongOpt("define").hasArg().withDescription("Define a system property")
            .create(CLIManager.SET_SYSTEM_PROPERTY));

    options.addOption(//from ww  w . j  a  va2  s .c o m
            OptionBuilder.withLongOpt("offline").withDescription("Work offline").create(CLIManager.OFFLINE));

    options.addOption(OptionBuilder.withLongOpt("help").withDescription("Display help information")
            .create(CLIManager.HELP));

    options.addOption(OptionBuilder.withLongOpt("version").withDescription("Display version information")
            .create(CLIManager.VERSION));

    options.addOption(OptionBuilder.withLongOpt("quiet").withDescription("Quiet output - only show errors")
            .create(CLIManager.QUIET));

    options.addOption(OptionBuilder.withLongOpt("debug").withDescription("Produce execution debug output")
            .create(CLIManager.DEBUG));

    options.addOption(OptionBuilder.withLongOpt("errors").withDescription("Produce execution error messages")
            .create(CLIManager.ERRORS));

    options.addOption(OptionBuilder.withLongOpt("non-recursive")
            .withDescription("Do not recurse into sub-projects").create(CLIManager.NON_RECURSIVE));

    options.addOption(OptionBuilder.withLongOpt("update-snapshots")
            .withDescription("Forces a check for updated releases and snapshots on remote repositories")
            .create(CLIManager.UPDATE_SNAPSHOTS));

    options.addOption(OptionBuilder.withLongOpt("activate-profiles")
            .withDescription("Comma-delimited list of profiles to activate").hasArg()
            .create(CLIManager.ACTIVATE_PROFILES));

    options.addOption(OptionBuilder.withLongOpt("batch-mode")
            .withDescription("Run in non-interactive (batch) mode").create(CLIManager.BATCH_MODE));

    options.addOption(OptionBuilder.withLongOpt("no-snapshot-updates")
            .withDescription("Supress SNAPSHOT updates").create(CLIManager.SUPRESS_SNAPSHOT_UPDATES));

    options.addOption(OptionBuilder.withLongOpt("strict-checksums")
            .withDescription("Fail the build if checksums don't match")
            .create(CLIManager.CHECKSUM_FAILURE_POLICY));

    options.addOption(OptionBuilder.withLongOpt("lax-checksums")
            .withDescription("Warn if checksums don't match").create(CLIManager.CHECKSUM_WARNING_POLICY));

    options.addOption(
            OptionBuilder.withLongOpt("settings").withDescription("Alternate path for the user settings file")
                    .hasArg().create(CLIManager.ALTERNATE_USER_SETTINGS));

    options.addOption(OptionBuilder.withLongOpt("global-settings")
            .withDescription("Alternate path for the global settings file").hasArg()
            .create(CLIManager.ALTERNATE_GLOBAL_SETTINGS));

    options.addOption(OptionBuilder.withLongOpt("toolchains")
            .withDescription("Alternate path for the user toolchains file").hasArg()
            .create(CLIManager.ALTERNATE_USER_TOOLCHAINS));

    options.addOption(OptionBuilder.withLongOpt("fail-fast")
            .withDescription("Stop at first failure in reactorized builds").create(CLIManager.FAIL_FAST));

    options.addOption(OptionBuilder.withLongOpt("fail-at-end")
            .withDescription("Only fail the build afterwards; allow all non-impacted builds to continue")
            .create(CLIManager.FAIL_AT_END));

    options.addOption(OptionBuilder.withLongOpt("fail-never")
            .withDescription("NEVER fail the build, regardless of project result")
            .create(CLIManager.FAIL_NEVER));

    options.addOption(OptionBuilder.withLongOpt("resume-from").hasArg()
            .withDescription("Resume reactor from specified project").create(CLIManager.RESUME_FROM));

    options.addOption(OptionBuilder.withLongOpt("projects").withDescription(
            "Build specified reactor projects instead of all projects. A project can be specified by [groupId]:artifactId or by its relative path.")
            .hasArg().create(CLIManager.PROJECT_LIST));

    options.addOption(OptionBuilder.withLongOpt("also-make")
            .withDescription("If project list is specified, also build projects required by the list")
            .create(CLIManager.ALSO_MAKE));

    options.addOption(OptionBuilder.withLongOpt("also-make-dependents")
            .withDescription(
                    "If project list is specified, also build projects that depend on projects on the list")
            .create(CLIManager.ALSO_MAKE_DEPENDENTS));

    options.addOption(OptionBuilder.withLongOpt("log-file").hasArg()
            .withDescription("Log file to where all build output will go.").create(CLIManager.LOG_FILE));

    options.addOption(OptionBuilder.withLongOpt("show-version")
            .withDescription("Display version information WITHOUT stopping build")
            .create(CLIManager.SHOW_VERSION));

    options.addOption(OptionBuilder.withLongOpt("encrypt-master-password").hasArg()
            .withDescription("Encrypt master security password").create(CLIManager.ENCRYPT_MASTER_PASSWORD));

    options.addOption(OptionBuilder.withLongOpt("encrypt-password").hasArg()
            .withDescription("Encrypt server password").create(CLIManager.ENCRYPT_PASSWORD));

    options.addOption(OptionBuilder.withLongOpt("threads").hasArg()
            .withDescription("Thread count, for instance 2.0C where C is core multiplied")
            .create(CLIManager.THREADS));

    // Adding this back in for compatibility with the verifier that hard codes this option.

    options.addOption(OptionBuilder.withLongOpt("no-plugin-registry")
            .withDescription("Ineffective, only kept for backward compatibility").create("npr"));
}

From source file:org.commonjava.emb.boot.main.EMBMain.java

License:Apache License

protected void cli(final CliRequest cliRequest) throws Exception {
    final EMBCLIManager cliManager = new EMBCLIManager();

    try {//from  ww  w.j a  va2  s . c  o m
        cliRequest.commandLine = cliManager.parse(cliRequest.args);
    } catch (final ParseException e) {
        cliRequest.builder.standardErr().println("Unable to parse command line options: " + e.getMessage());
        cliManager.displayHelp(cliRequest.builder.standardOut());
        throw e;
    }

    cliRequest.builder.withErrorMode(cliRequest.commandLine.hasOption(CLIManager.ERRORS)
            || cliRequest.commandLine.hasOption(CLIManager.DEBUG));
    cliRequest.builder.withDebugMode(cliRequest.commandLine.hasOption(CLIManager.DEBUG));
    cliRequest.builder.withQuietMode(cliRequest.commandLine.hasOption(CLIManager.QUIET));
    cliRequest.builder.withVersion(cliRequest.commandLine.hasOption(CLIManager.SHOW_VERSION));
    if (cliRequest.commandLine.hasOption(EMBCLIManager.XAVEN_DEBUG_LOG_HANDLES)) {
        cliRequest.builder.withDebugLogHandles(cliRequest.commandLine
                .getOptionValue(EMBCLIManager.XAVEN_DEBUG_LOG_HANDLES).split("\\s*,\\s*"));
    }

    if (cliRequest.commandLine.hasOption(CLIManager.LOG_FILE)) {
        cliRequest.builder.withLogFile(new File(cliRequest.commandLine.getOptionValue(CLIManager.LOG_FILE)));
    }

    // TODO: these should be moved out of here. Wrong place.
    //
    if (cliRequest.commandLine.hasOption(CLIManager.HELP)) {
        cliManager.displayHelp(cliRequest.builder.standardOut());
        throw new ExitException(0);
    }

    if (cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
        try {
            EMBEmbedder.showVersion(cliRequest.builder.embConfiguration(), cliRequest.builder.libraryLoaders(),
                    cliRequest.builder.standardOut());
        } catch (final IOException e) {
            cliRequest.builder.logger().error("Failed to retrieve EMB extension information: " + e.getMessage(),
                    e);
        }

        throw new ExitException(0);
    }
}

From source file:org.kie.workbench.common.services.backend.compiler.external339.AFMavenCli.java

License:Apache License

protected void cli(AFCliRequest cliRequest) throws Exception {
    ////from w w w. ja  v  a2s  . c om
    // Parsing errors can happen during the processing of the arguments and we prefer not having to check if
    // the logger is null and construct this so we can use an SLF4J logger everywhere.
    //

    slf4jLogger = new Slf4jStdoutLogger();

    CLIManager cliManager = new CLIManager();

    List<String> args = new ArrayList<String>();

    try {
        Path configFile = Paths.get(cliRequest.getMultiModuleProjectDirectory(), ".mvn/maven.config");

        if (java.nio.file.Files.isRegularFile(configFile)) {
            for (String arg : Files.toString(configFile.toFile(), Charsets.UTF_8).split("\\s+")) {
                args.add(arg);
            }

            CommandLine config = cliManager.parse(args.toArray(new String[args.size()]));
            List<?> unrecongized = config.getArgList();
            if (!unrecongized.isEmpty()) {
                throw new ParseException("Unrecognized maven.config entries: " + unrecongized);
            }
        }
    } catch (ParseException e) {
        System.err.println("Unable to parse maven.config: " + e.getMessage());
        cliManager.displayHelp(output);
        throw e;
    }

    try {
        args.addAll(0, Arrays.asList(cliRequest.getArgs()));
        cliRequest.setCommandLine(cliManager.parse(args.toArray(new String[args.size()])));
    } catch (ParseException e) {
        System.err.println("Unable to parse command line options: " + e.getMessage());
        cliManager.displayHelp(output);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        cliManager.displayHelp(ps);
        throw e;
    }

    if (cliRequest.getCommandLine().hasOption(CLIManager.HELP)) {
        cliManager.displayHelp(output);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        cliManager.displayHelp(ps);
        throw new ExitException(0);
    }

    if (cliRequest.getCommandLine().hasOption(CLIManager.VERSION)) {
        System.out.println(AFCLIReportingUtils.showVersion());
        throw new ExitException(0);
    }
}

From source file:org.kie.workbench.common.services.backend.compiler.impl.external339.AFMavenCli.java

License:Apache License

protected void cli(AFCliRequest cliRequest) throws Exception {
    ///*w  ww . ja  v  a2 s. com*/
    // Parsing errors can happen during the processing of the arguments and we prefer not having to check if
    // the logger is null and construct this so we can use an SLF4J logger everywhere.
    //
    slf4jLogger = new Slf4jStdoutLogger();

    /** promoted as a class variable and single instance because with multiple instances
     * on moderate/heavy load the parse of the argumentsub produce mistakes */
    //CLIManager cliManager = new CLIManager();

    List<String> args = new ArrayList<String>();

    try {
        Path configFile = Paths.get(cliRequest.getMultiModuleProjectDirectory(), ".mvn/maven.config");

        if (java.nio.file.Files.isRegularFile(configFile)) {
            for (String arg : Files.toString(configFile.toFile(), Charsets.UTF_8).split("\\s+")) {
                args.add(arg);
            }

            CommandLine config = cliManager.parse(args.toArray(new String[args.size()]));
            List<?> unrecongized = config.getArgList();
            if (!unrecongized.isEmpty()) {
                throw new ParseException("Unrecognized maven.config entries: " + unrecongized);
            }
        }
    } catch (ParseException e) {
        System.err.println("Unable to parse maven.config: " + e.getMessage());
        cliManager.displayHelp(output);
        throw e;
    }

    try {
        args.addAll(0, Arrays.asList(cliRequest.getArgs()));
        cliRequest.setCommandLine(cliManager.parse(args.toArray(new String[args.size()])));
    } catch (ParseException e) {
        System.err.println("Unable to parse command line options: " + e.getMessage());
        cliManager.displayHelp(output);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        cliManager.displayHelp(ps);
        throw e;
    }

    if (cliRequest.getCommandLine().hasOption(CLIManager.HELP)) {
        cliManager.displayHelp(output);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        cliManager.displayHelp(ps);
        throw new ExitException(0);
    }

    if (cliRequest.getCommandLine().hasOption(CLIManager.VERSION)) {
        System.out.println(AFCLIReportingUtils.showVersion());
        throw new ExitException(0);
    }
}

From source file:org.kie.workbench.common.services.backend.compiler.impl.external339.ReusableAFMavenCli.java

License:Apache License

protected void cli(AFCliRequest cliRequest) throws Exception {
    ////w  ww .  j a  va  2  s.c  om
    // Parsing errors can happen during the processing of the arguments and we prefer not having to check if
    // the logger is null and construct this so we can use an SLF4J logger everywhere.
    //
    reusableSlf4jLogger = new Slf4jStdoutLogger();

    /** promoted as a class variable and single instance because with multiple instances
     * on moderate/heavy load the parse of the argumentsub produce mistakes */
    //CLIManager cliManager = new CLIManager();

    List<String> args = new ArrayList<String>();

    try {
        Path configFile = Paths.get(cliRequest.getMultiModuleProjectDirectory(), ".mvn/maven.config");

        if (java.nio.file.Files.isRegularFile(configFile)) {
            for (String arg : Files.toString(configFile.toFile(), Charsets.UTF_8).split("\\s+")) {
                args.add(arg);
            }

            CommandLine config = cliManager.parse(args.toArray(new String[args.size()]));
            List<?> unrecongized = config.getArgList();
            if (!unrecongized.isEmpty()) {
                throw new ParseException("Unrecognized maven.config entries: " + unrecongized);
            }
        }
    } catch (ParseException e) {
        System.err.println("Unable to parse maven.config: " + e.getMessage());
        cliManager.displayHelp(output);
        throw e;
    }

    try {
        args.addAll(0, Arrays.asList(cliRequest.getArgs()));
        cliRequest.setCommandLine(cliManager.parse(args.toArray(new String[args.size()])));
    } catch (ParseException e) {
        System.err.println("Unable to parse command line options: " + e.getMessage());
        cliManager.displayHelp(output);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        cliManager.displayHelp(ps);
        throw e;
    }

    if (cliRequest.getCommandLine().hasOption(CLIManager.HELP)) {
        cliManager.displayHelp(output);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        cliManager.displayHelp(ps);
        throw new ExitException(0);
    }

    if (cliRequest.getCommandLine().hasOption(CLIManager.VERSION)) {
        System.out.println(AFCLIReportingUtils.showVersion());
        throw new ExitException(0);
    }
}

From source file:org.topdesk.maven.tracker.MavenCli.java

License:Apache License

private void cli(CliRequest cliRequest) throws Exception {
    CLIManager cliManager = new CLIManager();

    try {/*w  ww.java  2 s.  c  o  m*/
        cliRequest.commandLine = cliManager.parse(cliRequest.args);
    } catch (ParseException e) {
        cliRequest.stderr.println("Unable to parse command line options: " + e.getMessage());
        cliManager.displayHelp(cliRequest.stdout);
        throw e;
    }

    // TODO: these should be moved out of here. Wrong place.
    //
    if (cliRequest.commandLine.hasOption(CLIManager.HELP)) {
        cliManager.displayHelp(cliRequest.stdout);
        throw new ExitException(0);
    }

    if (cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
        CLIReportingUtils.showVersion(cliRequest.stdout);
        throw new ExitException(0);
    }
}