List of usage examples for org.apache.maven.cli.event ExecutionEventLogger ExecutionEventLogger
public ExecutionEventLogger()
From source file:com.google.code.play2.plugin.MavenPlay2Builder.java
License:Apache License
@Override /* Play2Builder */ public boolean build() throws Play2BuildFailure, Play2BuildError/*Play2BuildException*/ { Set<String> changedFilePaths = null; Map<String, Long> prevChangedFiles = new HashMap<String, Long>(); synchronized (changedFilesLock) { if (!changedFiles.isEmpty()) { changedFilePaths = changedFiles.keySet(); prevChangedFiles = changedFiles; changedFiles = new HashMap<String, Long>(); }/*ww w . ja v a 2 s.c o m*/ //TEST - more code inside synchronized block } if (!forceReloadNextTime && changedFilePaths == null /*&& afterFirstSuccessfulBuild*/ ) { return false; } List<MavenProject> projectsToBuild = projects; // - !afterFirstSuccessfulBuild => first build or no previous successful builds, build all modules // - currentSourceMaps.isEmpty() => first build, build all modules // - projects.size() == 1 => one-module project, just build it // - else => not the first build in multimodule-project, calculate modules subset to build if (afterFirstSuccessfulBuild /*!currentSourceMaps.isEmpty()*//*currentSourceMap != null*/ && projects.size() > 1) { projectsToBuild = calculateProjectsToBuild(changedFilePaths); } MavenExecutionRequest request = DefaultMavenExecutionRequest.copy(session.getRequest()); request.setStartTime(new Date()); request.setExecutionListener(new ExecutionEventLogger()); request.setGoals(goals); MavenExecutionResult result = new DefaultMavenExecutionResult(); MavenSession newSession = new MavenSession(container, session.getRepositorySession(), request, result); newSession.setProjects(projectsToBuild); newSession.setCurrentProject(session.getCurrentProject()); newSession.setParallel(session.isParallel()); newSession.setProjectDependencyGraph(session.getProjectDependencyGraph()); lifecycleExecutor.execute(newSession); forceReloadNextTime = result.hasExceptions(); if (!result.hasExceptions() && !additionalGoals.isEmpty()) { request = DefaultMavenExecutionRequest.copy(session.getRequest()); request.setStartTime(new Date()); request.setExecutionListener(new ExecutionEventLogger()); request.setGoals(additionalGoals); result = new DefaultMavenExecutionResult(); newSession = new MavenSession(container, session.getRepositorySession(), request, result); List<MavenProject> onlyMe = Arrays.asList(new MavenProject[] { session.getCurrentProject() }); newSession.setProjects(onlyMe); newSession.setCurrentProject(session.getCurrentProject()); newSession.setParallel(session.isParallel()); newSession.setProjectDependencyGraph(session.getProjectDependencyGraph()); lifecycleExecutor.execute(newSession); forceReloadNextTime = result.hasExceptions(); } if (result.hasExceptions()) { synchronized (changedFilesLock) { changedFiles.putAll(prevChangedFiles); // restore previously changed paths, required for next rebuild } Throwable firstException = result.getExceptions().get(0); if (firstException.getCause() instanceof MojoFailureException) { MojoFailureException mfe = (MojoFailureException) firstException.getCause(); Throwable mfeCause = mfe.getCause(); if (mfeCause != null) { try { Play2BuildException pbe = null; String causeName = mfeCause.getClass().getName(); // sbt-compiler exception if (CompilerException.class.getName().equals(causeName)) { pbe = getSBTCompilerBuildException(mfeCause); } else if (AssetCompilationException.class.getName().equals(causeName) || RoutesCompilationException.class.getName().equals(causeName) || TemplateCompilationException.class.getName().equals(causeName)) { pbe = getPlayBuildException(mfeCause); } if (pbe != null) { throw new Play2BuildFailure(pbe, sourceEncoding); } throw new Play2BuildError("Build failed without reporting any problem!"/*?, ce*/ ); } catch (Play2BuildFailure e) { throw e; } catch (Play2BuildError e) { throw e; } catch (Exception e) { throw new Play2BuildError(".... , check Maven console"); } } } throw new Play2BuildError("The compilation task failed, check Maven console"/*?, firstException*/ ); } // no exceptions if (!afterFirstSuccessfulBuild) // this was first successful build { afterFirstSuccessfulBuild = true; if (playWatchService != null) { // Monitor all existing, not generated (inside output directory) source and resource roots List<File> monitoredDirectories = new ArrayList<File>(); for (MavenProject p : projects) { String targetDirectory = p.getBuild().getDirectory(); for (String sourceRoot : p.getCompileSourceRoots()) { if (!sourceRoot.startsWith(targetDirectory) && new File(sourceRoot).isDirectory()) { monitoredDirectories.add(new File(sourceRoot)); } } for (Resource resource : p.getResources()) { String resourceRoot = resource.getDirectory(); if (!resourceRoot.startsWith(targetDirectory) && new File(resourceRoot).isDirectory()) { monitoredDirectories.add(new File(resourceRoot)); } } } //TODO - remove roots nested inside another roots (is it possible?) try { watcher = playWatchService.watch(monitoredDirectories, this); } catch (FileWatchException e) { logger.warn("File watcher initialization failed. Running without hot-reload functionality.", e); } } } Map<MavenProject, Map<String, File>> sourceMaps = new HashMap<MavenProject, Map<String, File>>( currentSourceMaps); for (MavenProject p : projectsToBuild) { Map<String, File> sourceMap = new HashMap<String, File>(); File classesDirectory = new File(p.getBuild().getOutputDirectory()); String classesDirectoryPath = classesDirectory.getAbsolutePath() + File.separator; File analysisCacheFile = defaultAnalysisCacheFile(p); Analysis analysis = sbtAnalysisProcessor.readFromFile(analysisCacheFile); for (File sourceFile : analysis.getSourceFiles()) { Set<File> sourceFileProducts = analysis.getProducts(sourceFile); for (File product : sourceFileProducts) { String absolutePath = product.getAbsolutePath(); if (absolutePath.contains("$")) { continue; // skip inner and object classes } String relativePath = absolutePath.substring(classesDirectoryPath.length()); // String name = product.getName(); String name = relativePath.substring(0, relativePath.length() - ".class".length()); /*if (name.indexOf( '$' ) > 0) { name = name.substring( 0, name.indexOf( '$' ) ); }*/ name = name.replace(File.separator, "."); //System.out.println(sourceFile.getPath() + " -> " + name); sourceMap.put(name, sourceFile); } /*String[] definitionNames = analysis.getDefinitionNames( sourceFile ); Set<String> uniqueDefinitionNames = new HashSet<String>(definitionNames.length); for (String definitionName: definitionNames) { if ( !uniqueDefinitionNames.contains( definitionName ) ) { result.put( definitionName, sourceFile ); // System.out.println( "definitionName:'" + definitionName + "', source:'" // + sourceFile.getAbsolutePath() + "'" ); uniqueDefinitionNames.add( definitionName ); } }*/ } sourceMaps.put(p, sourceMap); } this.currentSourceMaps = sourceMaps; boolean reloadRequired = false; for (MavenProject p : projectsToBuild) { long lastModifiedTime = 0L; Set<String> outputFilePaths = new HashSet<String>(); File outputDirectory = new File(p.getBuild().getOutputDirectory()); if (outputDirectory.exists() && outputDirectory.isDirectory()) { DirectoryScanner classPathScanner = new DirectoryScanner(); classPathScanner.setBasedir(outputDirectory); classPathScanner.setExcludes(new String[] { assetsPrefix + "**" }); classPathScanner.scan(); String[] files = classPathScanner.getIncludedFiles(); for (String fileName : files) { File f = new File(outputDirectory, fileName); outputFilePaths.add(f.getAbsolutePath()); long lmf = f.lastModified(); if (lmf > lastModifiedTime) { lastModifiedTime = lmf; } } } if (!reloadRequired && (lastModifiedTime > currentClasspathTimestamps.get(p).longValue() || !outputFilePaths.equals(currentClasspathFilePaths.get(p)))) { reloadRequired = true; } currentClasspathTimestamps.put(p, Long.valueOf(lastModifiedTime)); currentClasspathFilePaths.put(p, outputFilePaths); } return reloadRequired; }
From source file:org.kie.workbench.common.services.backend.compiler.external339.AFMavenCli.java
License:Apache License
protected MavenExecutionRequest populateRequest(AFCliRequest cliRequest, MavenExecutionRequest request) { CommandLine commandLine = cliRequest.getCommandLine(); String workingDirectory = cliRequest.getWorkingDirectory(); boolean quiet = cliRequest.isQuiet(); boolean showErrors = cliRequest.isShowErrors(); String[] deprecatedOptions = { "up", "npu", "cpu", "npr" }; for (String deprecatedOption : deprecatedOptions) { if (commandLine.hasOption(deprecatedOption)) { slf4jLogger.warn("Command line option -" + deprecatedOption + " is deprecated and will be removed in future Maven versions."); }//www .j a v a 2s. c om } // ---------------------------------------------------------------------- // Now that we have everything that we need we will fire up plexus and // bring the maven component to life for use. // ---------------------------------------------------------------------- if (commandLine.hasOption(CLIManager.BATCH_MODE)) { request.setInteractiveMode(false); } boolean noSnapshotUpdates = false; if (commandLine.hasOption(CLIManager.SUPRESS_SNAPSHOT_UPDATES)) { noSnapshotUpdates = true; } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- @SuppressWarnings("unchecked") List<String> goals = commandLine.getArgList(); boolean recursive = true; // this is the default behavior. String reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST; if (commandLine.hasOption(CLIManager.NON_RECURSIVE)) { recursive = false; } if (commandLine.hasOption(CLIManager.FAIL_FAST)) { reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST; } else if (commandLine.hasOption(CLIManager.FAIL_AT_END)) { reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_AT_END; } else if (commandLine.hasOption(CLIManager.FAIL_NEVER)) { reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_NEVER; } if (commandLine.hasOption(CLIManager.OFFLINE)) { request.setOffline(true); } boolean updateSnapshots = false; if (commandLine.hasOption(CLIManager.UPDATE_SNAPSHOTS)) { updateSnapshots = true; } String globalChecksumPolicy = null; if (commandLine.hasOption(CLIManager.CHECKSUM_FAILURE_POLICY)) { globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_FAIL; } else if (commandLine.hasOption(CLIManager.CHECKSUM_WARNING_POLICY)) { globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_WARN; } File baseDirectory = new File(workingDirectory, "").getAbsoluteFile(); // ---------------------------------------------------------------------- // Profile Activation // ---------------------------------------------------------------------- List<String> activeProfiles = new ArrayList<String>(); List<String> inactiveProfiles = new ArrayList<String>(); if (commandLine.hasOption(CLIManager.ACTIVATE_PROFILES)) { String[] profileOptionValues = commandLine.getOptionValues(CLIManager.ACTIVATE_PROFILES); if (profileOptionValues != null) { for (String profileOptionValue : profileOptionValues) { StringTokenizer profileTokens = new StringTokenizer(profileOptionValue, ","); while (profileTokens.hasMoreTokens()) { String profileAction = profileTokens.nextToken().trim(); if (profileAction.startsWith("-") || profileAction.startsWith("!")) { inactiveProfiles.add(profileAction.substring(1)); } else if (profileAction.startsWith("+")) { activeProfiles.add(profileAction.substring(1)); } else { activeProfiles.add(profileAction); } } } } } TransferListener transferListener; if (quiet) { transferListener = new QuietMavenTransferListener(); } else if (request.isInteractiveMode() && !cliRequest.getCommandLine().hasOption(CLIManager.LOG_FILE)) { // // If we're logging to a file then we don't want the console transfer listener as it will spew // download progress all over the place // transferListener = getConsoleTransferListener(); } else { transferListener = getBatchTransferListener(); } ExecutionListener executionListener = new ExecutionEventLogger(); if (eventSpyDispatcher != null) { executionListener = eventSpyDispatcher.chainListener(executionListener); } String alternatePomFile = null; if (commandLine.hasOption(CLIManager.ALTERNATE_POM_FILE)) { alternatePomFile = commandLine.getOptionValue(CLIManager.ALTERNATE_POM_FILE); } request.setBaseDirectory(baseDirectory).setGoals(goals) .setSystemProperties(cliRequest.getSystemProperties()) .setUserProperties(cliRequest.getUserProperties()) .setReactorFailureBehavior(reactorFailureBehaviour) // default: fail fast .setRecursive(recursive) // default: true .setShowErrors(showErrors) // default: false .addActiveProfiles(activeProfiles) // optional .addInactiveProfiles(inactiveProfiles) // optional .setExecutionListener(executionListener).setTransferListener(transferListener) // default: batch mode which goes along with interactive .setUpdateSnapshots(updateSnapshots) // default: false .setNoSnapshotUpdates(noSnapshotUpdates) // default: false .setGlobalChecksumPolicy(globalChecksumPolicy) // default: warn .setMultiModuleProjectDirectory(new File(cliRequest.getMultiModuleProjectDirectory())); if (alternatePomFile != null) { File pom = resolveFile(new File(alternatePomFile.trim()), workingDirectory); if (pom.isDirectory()) { pom = new File(pom, "pom.xml"); } request.setPom(pom); } else if (modelProcessor != null) { File pom = modelProcessor.locatePom(baseDirectory); if (pom.isFile()) { request.setPom(pom); } } if ((request.getPom() != null) && (request.getPom().getParentFile() != null)) { request.setBaseDirectory(request.getPom().getParentFile()); } if (commandLine.hasOption(CLIManager.RESUME_FROM)) { request.setResumeFrom(commandLine.getOptionValue(CLIManager.RESUME_FROM)); } if (commandLine.hasOption(CLIManager.PROJECT_LIST)) { String[] projectOptionValues = commandLine.getOptionValues(CLIManager.PROJECT_LIST); List<String> inclProjects = new ArrayList<String>(); List<String> exclProjects = new ArrayList<String>(); if (projectOptionValues != null) { for (String projectOptionValue : projectOptionValues) { StringTokenizer projectTokens = new StringTokenizer(projectOptionValue, ","); while (projectTokens.hasMoreTokens()) { String projectAction = projectTokens.nextToken().trim(); if (projectAction.startsWith("-") || projectAction.startsWith("!")) { exclProjects.add(projectAction.substring(1)); } else if (projectAction.startsWith("+")) { inclProjects.add(projectAction.substring(1)); } else { inclProjects.add(projectAction); } } } } request.setSelectedProjects(inclProjects); request.setExcludedProjects(exclProjects); } if (commandLine.hasOption(CLIManager.ALSO_MAKE) && !commandLine.hasOption(CLIManager.ALSO_MAKE_DEPENDENTS)) { request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM); } else if (!commandLine.hasOption(CLIManager.ALSO_MAKE) && commandLine.hasOption(CLIManager.ALSO_MAKE_DEPENDENTS)) { request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM); } else if (commandLine.hasOption(CLIManager.ALSO_MAKE) && commandLine.hasOption(CLIManager.ALSO_MAKE_DEPENDENTS)) { request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_BOTH); } String localRepoProperty = request.getUserProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY); if (localRepoProperty == null) { localRepoProperty = request.getSystemProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY); } if (localRepoProperty != null) { request.setLocalRepositoryPath(localRepoProperty); } request.setCacheNotFound(true); request.setCacheTransferError(false); // // Builder, concurrency and parallelism // // We preserve the existing methods for builder selection which is to look for various inputs in the threading // configuration. We don't have an easy way to allow a pluggable builder to provide its own configuration // parameters but this is sufficient for now. Ultimately we want components like Builders to provide a way to // extend the command line to accept its own configuration parameters. // final String threadConfiguration = commandLine.hasOption(CLIManager.THREADS) ? commandLine.getOptionValue(CLIManager.THREADS) : request.getSystemProperties().getProperty(MavenCli.THREADS_DEPRECATED); // TODO: Remove this setting. Note that the int-tests use it if (threadConfiguration != null) { // // Default to the standard multithreaded builder // request.setBuilderId("multithreaded"); if (threadConfiguration.contains("C")) { request.setDegreeOfConcurrency(calculateDegreeOfConcurrencyWithCoreMultiplier(threadConfiguration)); } else { request.setDegreeOfConcurrency(Integer.valueOf(threadConfiguration)); } } // // Allow the builder to be overriden by the user if requested. The builders are now pluggable. // if (commandLine.hasOption(CLIManager.BUILDER)) { request.setBuilderId(commandLine.getOptionValue(CLIManager.BUILDER)); } return request; }
From source file:org.kie.workbench.common.services.backend.compiler.impl.external339.ReusableAFMavenCli.java
License:Apache License
protected MavenExecutionRequest populateRequest(AFCliRequest cliRequest, MavenExecutionRequest request) { CommandLine commandLine = cliRequest.getCommandLine(); String workingDirectory = cliRequest.getWorkingDirectory(); boolean quiet = cliRequest.isQuiet(); boolean showErrors = cliRequest.isShowErrors(); String[] deprecatedOptions = { "up", "npu", "cpu", "npr" }; for (String deprecatedOption : deprecatedOptions) { if (commandLine.hasOption(deprecatedOption)) { reusableSlf4jLogger.warn("Command line option -" + deprecatedOption + " is deprecated and will be removed in future Maven versions."); }/* www .j a v a2 s .c o m*/ } // ---------------------------------------------------------------------- // Now that we have everything that we need we will fire up plexus and // bring the maven component to life for use. // ---------------------------------------------------------------------- if (commandLine.hasOption(CLIManager.BATCH_MODE)) { request.setInteractiveMode(false); } boolean noSnapshotUpdates = false; if (commandLine.hasOption(CLIManager.SUPRESS_SNAPSHOT_UPDATES)) { noSnapshotUpdates = true; } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- @SuppressWarnings("unchecked") List<String> goals = commandLine.getArgList(); boolean recursive = true; // this is the default behavior. String reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST; if (commandLine.hasOption(CLIManager.NON_RECURSIVE)) { recursive = false; } if (commandLine.hasOption(CLIManager.FAIL_FAST)) { reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST; } else if (commandLine.hasOption(CLIManager.FAIL_AT_END)) { reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_AT_END; } else if (commandLine.hasOption(CLIManager.FAIL_NEVER)) { reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_NEVER; } if (commandLine.hasOption(CLIManager.OFFLINE)) { request.setOffline(true); } boolean updateSnapshots = false; if (commandLine.hasOption(CLIManager.UPDATE_SNAPSHOTS)) { updateSnapshots = true; } String globalChecksumPolicy = null; if (commandLine.hasOption(CLIManager.CHECKSUM_FAILURE_POLICY)) { globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_FAIL; } else if (commandLine.hasOption(CLIManager.CHECKSUM_WARNING_POLICY)) { globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_WARN; } File baseDirectory = new File(workingDirectory, "").getAbsoluteFile(); // ---------------------------------------------------------------------- // Profile Activation // ---------------------------------------------------------------------- List<String> activeProfiles = new ArrayList<String>(); List<String> inactiveProfiles = new ArrayList<String>(); if (commandLine.hasOption(CLIManager.ACTIVATE_PROFILES)) { String[] profileOptionValues = commandLine.getOptionValues(CLIManager.ACTIVATE_PROFILES); if (profileOptionValues != null) { for (String profileOptionValue : profileOptionValues) { StringTokenizer profileTokens = new StringTokenizer(profileOptionValue, ","); while (profileTokens.hasMoreTokens()) { String profileAction = profileTokens.nextToken().trim(); if (profileAction.startsWith("-") || profileAction.startsWith("!")) { inactiveProfiles.add(profileAction.substring(1)); } else if (profileAction.startsWith("+")) { activeProfiles.add(profileAction.substring(1)); } else { activeProfiles.add(profileAction); } } } } } TransferListener transferListener; if (quiet) { transferListener = new QuietMavenTransferListener(); } else if (request.isInteractiveMode() && !cliRequest.getCommandLine().hasOption(CLIManager.LOG_FILE)) { // // If we're logging to a file then we don't want the console transfer listener as it will spew // download progress all over the place // transferListener = getConsoleTransferListener(); } else { transferListener = getBatchTransferListener(); } ExecutionListener executionListener = new ExecutionEventLogger(); if (reusableEventSpyDispatcher != null) { executionListener = reusableEventSpyDispatcher.chainListener(executionListener); } String alternatePomFile = null; if (commandLine.hasOption(CLIManager.ALTERNATE_POM_FILE)) { alternatePomFile = commandLine.getOptionValue(CLIManager.ALTERNATE_POM_FILE); } request.setBaseDirectory(baseDirectory).setGoals(goals) .setSystemProperties(cliRequest.getSystemProperties()) .setUserProperties(cliRequest.getUserProperties()) .setReactorFailureBehavior(reactorFailureBehaviour) // default: fail fast .setRecursive(recursive) // default: true .setShowErrors(showErrors) // default: false .addActiveProfiles(activeProfiles) // optional .addInactiveProfiles(inactiveProfiles) // optional .setExecutionListener(executionListener).setTransferListener(transferListener) // default: batch mode which goes along with interactive .setUpdateSnapshots(updateSnapshots) // default: false .setNoSnapshotUpdates(noSnapshotUpdates) // default: false .setGlobalChecksumPolicy(globalChecksumPolicy) // default: warn .setMultiModuleProjectDirectory(new File(cliRequest.getMultiModuleProjectDirectory())); if (alternatePomFile != null) { File pom = resolveFile(new File(alternatePomFile.trim()), workingDirectory); if (pom.isDirectory()) { pom = new File(pom, "pom.xml"); } request.setPom(pom); } else if (reusableModelProcessor != null) { File pom = reusableModelProcessor.locatePom(baseDirectory); if (pom.isFile()) { request.setPom(pom); } } if ((request.getPom() != null) && (request.getPom().getParentFile() != null)) { request.setBaseDirectory(request.getPom().getParentFile()); } if (commandLine.hasOption(CLIManager.RESUME_FROM)) { request.setResumeFrom(commandLine.getOptionValue(CLIManager.RESUME_FROM)); } if (commandLine.hasOption(CLIManager.PROJECT_LIST)) { String[] projectOptionValues = commandLine.getOptionValues(CLIManager.PROJECT_LIST); List<String> inclProjects = new ArrayList<String>(); List<String> exclProjects = new ArrayList<String>(); if (projectOptionValues != null) { for (String projectOptionValue : projectOptionValues) { StringTokenizer projectTokens = new StringTokenizer(projectOptionValue, ","); while (projectTokens.hasMoreTokens()) { String projectAction = projectTokens.nextToken().trim(); if (projectAction.startsWith("-") || projectAction.startsWith("!")) { exclProjects.add(projectAction.substring(1)); } else if (projectAction.startsWith("+")) { inclProjects.add(projectAction.substring(1)); } else { inclProjects.add(projectAction); } } } } request.setSelectedProjects(inclProjects); request.setExcludedProjects(exclProjects); } if (commandLine.hasOption(CLIManager.ALSO_MAKE) && !commandLine.hasOption(CLIManager.ALSO_MAKE_DEPENDENTS)) { request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_UPSTREAM); } else if (!commandLine.hasOption(CLIManager.ALSO_MAKE) && commandLine.hasOption(CLIManager.ALSO_MAKE_DEPENDENTS)) { request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM); } else if (commandLine.hasOption(CLIManager.ALSO_MAKE) && commandLine.hasOption(CLIManager.ALSO_MAKE_DEPENDENTS)) { request.setMakeBehavior(MavenExecutionRequest.REACTOR_MAKE_BOTH); } String localRepoProperty = request.getUserProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY); if (localRepoProperty == null) { localRepoProperty = request.getSystemProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY); } if (localRepoProperty != null) { request.setLocalRepositoryPath(localRepoProperty); } request.setCacheNotFound(true); request.setCacheTransferError(false); // // Builder, concurrency and parallelism // // We preserve the existing methods for builder selection which is to look for various inputs in the threading // configuration. We don't have an easy way to allow a pluggable builder to provide its own configuration // parameters but this is sufficient for now. Ultimately we want components like Builders to provide a way to // extend the command line to accept its own configuration parameters. // final String threadConfiguration = commandLine.hasOption(CLIManager.THREADS) ? commandLine.getOptionValue(CLIManager.THREADS) : request.getSystemProperties().getProperty(MavenCli.THREADS_DEPRECATED); // TODO: Remove this setting. Note that the int-tests use it if (threadConfiguration != null) { // // Default to the standard multithreaded builder // request.setBuilderId("multithreaded"); if (threadConfiguration.contains("C")) { request.setDegreeOfConcurrency(calculateDegreeOfConcurrencyWithCoreMultiplier(threadConfiguration)); } else { request.setDegreeOfConcurrency(Integer.valueOf(threadConfiguration)); } } // // Allow the builder to be overriden by the user if requested. The builders are now pluggable. // if (commandLine.hasOption(CLIManager.BUILDER)) { request.setBuilderId(commandLine.getOptionValue(CLIManager.BUILDER)); } return request; }