CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; this.classWorld = classWorld; this.request = new DefaultMavenExecutionRequest(); }
@Deprecated @SuppressWarnings( "checkstyle:parameternumber" ) public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository, EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals, String executionRootDir, Properties executionProperties, Properties userProperties, Date startTime ) { this.container = container; this.settings = settings; this.executionProperties = executionProperties; this.request = new DefaultMavenExecutionRequest(); this.request.setUserProperties( userProperties ); this.request.setLocalRepository( localRepository ); this.request.setGoals( goals ); this.request.setBaseDirectory( ( executionRootDir != null ) ? new File( executionRootDir ) : null ); this.request.setStartTime( startTime ); }
/** * * @param project * @return * @since 2.0 */ protected MavenSession newMavenSession( MavenProject project ) { MavenExecutionRequest request = new DefaultMavenExecutionRequest(); MavenExecutionResult result = new DefaultMavenExecutionResult(); MavenSession session = new MavenSession( container, MavenRepositorySystemUtils.newSession(), request, result ); session.setCurrentProject( project ); session.setProjects( Arrays.asList( project ) ); return session; }
/** * @since 3.1.0 */ public MavenProject readMavenProject( File basedir ) throws Exception { File pom = new File( basedir, "pom.xml" ); MavenExecutionRequest request = new DefaultMavenExecutionRequest(); request.setBaseDirectory( basedir ); ProjectBuildingRequest configuration = request.getProjectBuildingRequest(); configuration.setRepositorySession( new DefaultRepositorySystemSession() ); MavenProject project = lookup( ProjectBuilder.class ).build( pom, configuration ).getProject(); Assert.assertNotNull( project ); return project; }
public static MavenExecutionRequest copy( MavenExecutionRequest original ) DefaultMavenExecutionRequest copy = new DefaultMavenExecutionRequest(); copy.setLocalRepository( original.getLocalRepository() ); copy.setLocalRepositoryPath( original.getLocalRepositoryPath() );
CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; this.classWorld = classWorld; this.request = new DefaultMavenExecutionRequest(); }
CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; this.classWorld = classWorld; this.request = new DefaultMavenExecutionRequest(); } }
CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; this.classWorld = classWorld; this.request = new DefaultMavenExecutionRequest(); } }
CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; this.classWorld = classWorld; this.request = new DefaultMavenExecutionRequest(); } }
CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; this.classWorld = classWorld; this.request = new DefaultMavenExecutionRequest(); } }
/** * {@inheritDoc} * * @see org.apache.maven.mae.project.session.ProjectToolsSession#getExecutionRequest() */ @Override public synchronized MavenExecutionRequest getExecutionRequest() { if ( executionRequest == null ) { executionRequest = new DefaultMavenExecutionRequest(); } return executionRequest; }
public AFCliRequest(String multiModuleProjectDirectory, String[] args, Map<String, Object> map, String requestUUID, Properties bannedEnvVars) { this.multiModuleProjectDirectory = multiModuleProjectDirectory; this.workingDirectory = multiModuleProjectDirectory; this.request = new DefaultMavenExecutionRequest(); this.args = args; this.map = new HashMap<>(map); this.requestUUID = requestUUID; this.bannedEnvVars = bannedEnvVars; }
public static void main(String [] argv) { DefaultMavenExecutionRequest dmer = new DefaultMavenExecutionRequest(); dmer.setGoals(Arrays.asList("clean")); DefaultMaven dm = new DefaultMaven(); dm.execute(dmer); } }
protected MavenExecutionRequest newMavenExecutionRequest(File pom) throws Exception { Properties systemProps = new Properties(); systemProps.putAll(System.getProperties()); Properties userProps = new Properties(); userProps.put("tycho-version", "0.0.0"); MavenExecutionRequest request = new DefaultMavenExecutionRequest(); request.setBaseDirectory(pom.getParentFile()); request.setPom(pom); request.setSystemProperties(systemProps); request.setUserProperties(userProps); request.setLocalRepository(getLocalRepository()); request.setGoals( Arrays.asList( "validate" ) ); return request; }
public MavenProject readMavenProject(Path pom) throws Exception { MavenExecutionRequest request = new DefaultMavenExecutionRequest(); request.setBaseDirectory(pom.getParent().toFile()); ProjectBuildingRequest configuration = request.getProjectBuildingRequest(); configuration.setRepositorySession(new DefaultRepositorySystemSession()); MavenProject project = rule.lookup(ProjectBuilder.class).build(pom.toFile(), configuration).getProject(); Assert.assertNotNull(project); return project; }
protected MavenExecutionRequest newMavenExecutionRequest(File pom) throws Exception { Properties systemProps = new Properties(); systemProps.putAll(System.getProperties()); Properties userProps = new Properties(); userProps.put("tycho-version", "0.0.0"); MavenExecutionRequest request = new DefaultMavenExecutionRequest(); request.setBaseDirectory(pom.getParentFile()); request.setPom(pom); request.setSystemProperties(systemProps); request.setUserProperties(userProps); request.setLocalRepository(getLocalRepository()); request.setStartTime(new Date()); File settingsFile = getUserSettingsFile(); if (settingsFile.isFile()) { request.setUserSettingsFile(settingsFile); } Settings settings = settingsBuilder.buildSettings(request); requestPopulator.populateFromSettings(request, settings); request.setGoals(Arrays.asList("validate")); return request; }
/** * * @param project * @return * @since 2.0 */ protected MavenSession newMavenSession( MavenProject project ) { MavenExecutionRequest request = new DefaultMavenExecutionRequest(); MavenExecutionResult result = new DefaultMavenExecutionResult(); MavenSession session = new MavenSession( container, MavenRepositorySystemUtils.newSession(), request, result ); session.setCurrentProject( project ); session.setProjects( Arrays.asList( project ) ); return session; }
/** * @param globalSettings null to use default * @param userSettings null to use default */ public static Settings loadSettings(World world, FileNode globalSettings, FileNode userSettings, DefaultPlexusContainer container) throws IOException, XmlPullParserException, ComponentLookupException { DefaultMavenSettingsBuilder builder; MavenExecutionRequest request; builder = (DefaultMavenSettingsBuilder) container.lookup(MavenSettingsBuilder.ROLE); request = new DefaultMavenExecutionRequest(); if (globalSettings == null) { globalSettings = locateMaven(world).join("conf/settings.xml"); } if (userSettings == null) { userSettings = (FileNode) world.getHome().join(".m2/settings.xml"); } request.setGlobalSettingsFile(globalSettings.toPath().toFile()); request.setUserSettingsFile(userSettings.toPath().toFile()); return builder.buildSettings(request); }
public void run() { MavenEmbedder online = EmbedderFactory.getOnlineEmbedder(); AggregateProgressHandle hndl = AggregateProgressFactory.createHandle(NbBundle.getMessage(ProjectURLWatcher.class, "Progress_Download"), new ProgressContributor[] { AggregateProgressFactory.createProgressContributor("zaloha") }, //NOI18N null, null); boolean ok = true; try { ProgressTransferListener.setAggregateHandle(hndl); hndl.start(); MavenExecutionRequest req = new DefaultMavenExecutionRequest(); req.setPom(FileUtil.toFile(project.getProjectDirectory().getFileObject("pom.xml"))); MavenExecutionResult res = online.readProjectWithDependencies(req); //NOI18N if (res.hasExceptions()) { ok = false; Exception ex = (Exception)res.getExceptions().get(0); StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(ProjectURLWatcher.class, "MSG_Failed", ex.getLocalizedMessage())); } } finally { hndl.finish(); ProgressTransferListener.clearAggregateHandle(); } if (ok) { StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(ProjectURLWatcher.class, "MSG_Done")); } ProjectURLWatcher.fireMavenProjectReload(project); } });
protected MavenExecutionRequest mavenConfiguration() throws MavenClasspathExtractionException { MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest(); try { MavenExecutionRequestPopulator executionRequestPopulator = lookup(MavenExecutionRequestPopulator.class); MavenExecutionRequestPopulator populator = lookup(MavenExecutionRequestPopulator.class); mavenExecutionRequest.setInteractiveMode(false); mavenExecutionRequest.setSystemProperties(System.getProperties()); mavenExecutionRequest.getSystemProperties().putAll(getEnvVars()); Settings settings = getSettings(mavenExecutionRequest); executionRequestPopulator.populateFromSettings(mavenExecutionRequest, settings); populator.populateDefaults(mavenExecutionRequest); logger.debug( "Local repository " + mavenExecutionRequest.getLocalRepository()); } catch (ComponentLookupException e) { throw new MavenClasspathExtractionException(e); } catch (SettingsBuildingException e) { throw new MavenClasspathExtractionException(e); } catch (MavenExecutionRequestPopulationException e) { throw new MavenClasspathExtractionException(e); } return mavenExecutionRequest; }