Examples of MavenRuntime


Examples of org.eclipse.m2e.core.embedder.MavenRuntime

    }

    public boolean isRuntimeConfigured() throws IOException {
      MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
      String path = location.getCanonicalPath();
      MavenRuntime runtime = runtimeManager.getRuntime(path);
      return (runtime != null && runtime.isAvailable());
    }
View Full Code Here

Examples of org.eclipse.m2e.core.embedder.MavenRuntime

    public IStatus configure(IProgressMonitor monitor) {
      try {
        MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();

        String path = location.getCanonicalPath();
        MavenRuntime runtime = runtimeManager.getRuntime(path);

        // Get the existing default runtime in case we need to revert later
        oldDefaultRuntime = runtimeManager.getDefaultRuntime();

        // If a runtime at the given path already exists make it the default
        if (runtime != null && runtime.isAvailable()) {
          if (!runtime.equals(oldDefaultRuntime)) {
            runtimeManager.setDefaultRuntime(runtime);
          }
          setConfigured(true);
          return new Status(IStatus.INFO, MavenCorePlugin.PLUGIN_ID, NLS.bind("Maven already configured at {0}", path));
        }
View Full Code Here

Examples of org.eclipse.m2e.core.embedder.MavenRuntime

    public IStatus unConfigure(IProgressMonitor monitor) {
      try {
        MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();

        String path = location.getCanonicalPath();
        MavenRuntime runtime = runtimeManager.getRuntime(path);

        // Remove the newly added runtime
        if (runtime != null) {
          List<MavenRuntime> runtimes = runtimeManager.getMavenRuntimes();
          runtimes.remove(runtime);
View Full Code Here

Examples of org.sonatype.maven.shell.maven.MavenRuntime

            config.setLogFile(logFile);
        }

        customize(config);

        MavenRuntime runtime = maven.create(config);
        MavenExecutionRequest request = runtime.create();

        if (offline != null) {
            request.setOffline(offline);
        }
        if (goals != null) {
            request.setGoals(goals);
        }
        if (batch != null) {
            request.setInteractiveMode(!batch);
        }
        if (resumeFrom != null) {
            request.setResumeFrom(resumeFrom);
        }
        if (toolChainsFile != null) {
            request.setUserToolchainsFile(toolChainsFile);
        }
        if (showErrors != null) {
            request.setShowErrors(showErrors);
        }
        if (nonRecursive != null) {
            request.setRecursive(!nonRecursive);
        }
        if (updateSnapshots != null) {
            request.setUpdateSnapshots(updateSnapshots);
        }
        if (noSnapshotUpdates != null) {
            request.setNoSnapshotUpdates(noSnapshotUpdates);
        }
        if (selectedProjects != null) {
            request.setSelectedProjects(selectedProjects);
        }

        if (strictChecksums) {
            request.setGlobalChecksumPolicy(CHECKSUM_POLICY_FAIL);
        }
        if (laxChecksums) {
            request.setGlobalChecksumPolicy(CHECKSUM_POLICY_WARN);
        }

        if (failFast) {
            request.setReactorFailureBehavior(REACTOR_FAIL_FAST);
        }
        else if (failAtEnd) {
            request.setReactorFailureBehavior(REACTOR_FAIL_AT_END);
        }
        else if (failNever) {
            request.setReactorFailureBehavior(REACTOR_FAIL_NEVER);
        }

        if (alsoMake && !alsoMakeDependents) {
            request.setMakeBehavior(REACTOR_MAKE_UPSTREAM);
        }
        else if (!alsoMake && alsoMakeDependents) {
            request.setMakeBehavior(REACTOR_MAKE_DOWNSTREAM);
        }
        else if (alsoMake && alsoMakeDependents) {
            request.setMakeBehavior(REACTOR_MAKE_BOTH);
        }

        // Customize the plugin groups
        request.addPluginGroup("org.apache.maven.plugins");
        request.addPluginGroup("org.codehaus.mojo");
        request.addPluginGroup("com.sonatype.maven.plugins");
        request.addPluginGroup("org.sonatype.maven.plugins");

        // Setup output colorization
        StreamSet current = StreamJack.current();
        StreamSet streams;
        if (color == null || color) {
            // Complain if the user asked for color and its not supported
            if (color != null && !io.getTerminal().isAnsiSupported()) {
                log.warn("ANSI color is not supported by the current terminal");
            }
            streams = new StreamSet(current.in, new ColorizingStream(current.out), new ColorizingStream(current.err));
        }
        else {
            streams = current;
        }
        config.setStreams(streams);

        StreamJack.register(streams);

        // Execute Maven
        int result = 0;
        try {
            result = runtime.execute(request);
        }
        finally {
            StreamJack.deregister();
            // HACK: Not sure why, but we need to reset the terminal after some mvn builds
            io.getTerminal().reset();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.