List of usage examples for org.apache.maven.execution MavenExecutionRequest setProfiles
MavenExecutionRequest setProfiles(List<Profile> profiles);
From source file:org.maven.ide.eclipse.embedder.MavenModelManager.java
License:Apache License
public MavenExecutionResult readMavenProject(File pomFile, IProgressMonitor monitor, // boolean offline, boolean debug, ResolverConfiguration resolverConfiguration, MavenEmbedder embedder) { try {//from www. j a v a 2 s . c o m // monitor.subTask("Reading " + pomFile.getFullPath()); // File file = pomFile.getLocation().toFile(); MavenExecutionRequest request = EmbedderFactory.createMavenExecutionRequest(embedder, offline, debug); request.setPomFile(pomFile.getAbsolutePath()); request.setBaseDirectory(pomFile.getParentFile()); request.setTransferListener(new TransferListenerAdapter(monitor, console, indexManager)); request.setProfiles(resolverConfiguration.getActiveProfileList()); request.addActiveProfiles(resolverConfiguration.getActiveProfileList()); return embedder.readProjectWithDependencies(request); // XXX need to manage markers somehow see MNGECLIPSE-*** // Util.deleteMarkers(pomFile); // if(!result.hasExceptions()) { // return result.getMavenProject(); // } // // return result.getMavenProject(); // } catch(Exception ex) { // Util.deleteMarkers(this.file); // Util.addMarker(this.file, "Unable to read project; " + ex.toString(), 1, IMarker.SEVERITY_ERROR); // // String msg = "Unable to read " + file.getLocation() + "; " + ex.toString(); // console.logError(msg); // Maven2Plugin.log(msg, ex); } finally { monitor.done(); } }