/** * Gets the system properties to use for interpolation and profile activation. The system properties are collected * from the runtime environment like {@link System#getProperties()} and environment variables. * * @return The system properties, never {@code null}. */ public Properties getSystemProperties() { return request.getSystemProperties(); }
/** * @deprecated Use either {@link #getUserProperties()} or {@link #getSystemProperties()}. */ @Deprecated public Properties getExecutionProperties() { if ( executionProperties == null ) { executionProperties = new Properties(); executionProperties.putAll( request.getSystemProperties() ); executionProperties.putAll( request.getUserProperties() ); } return executionProperties; }
localRepoProperty = request.getSystemProperties().getProperty( MavenCli.LOCAL_REPO_PROPERTY );
/** @since 2.1 */ public Settings buildSettings( MavenExecutionRequest request ) throws IOException, XmlPullParserException { SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest(); settingsRequest.setUserSettingsFile( request.getUserSettingsFile() ); settingsRequest.setGlobalSettingsFile( request.getGlobalSettingsFile() ); settingsRequest.setUserProperties( request.getUserProperties() ); settingsRequest.setSystemProperties( request.getSystemProperties() ); return build( settingsRequest ); }
configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() ); configProps.put( ConfigurationProperties.INTERACTIVE, request.isInteractiveMode() ); configProps.putAll( request.getSystemProperties() ); configProps.putAll( request.getUserProperties() ); session.setSystemProperties( request.getSystemProperties() ); session.setConfigProperties( configProps );
private void setup( String gav, ClassRealm realm ) throws MalformedURLException { // looking into another JRUBY_HOME is for jruby itself only to allow // jruby build to use itself for bootstraping // see if we have shall use jruby from somewhere else String jrubyHome = System.getenv( "POLYGLOT_JRUBY_HOME" ); if ( jrubyHome == null ){ jrubyHome = System.getProperty( JRUBY_HOME ); } if ( jrubyHome == null ){ jrubyHome = legacySupport.getSession().getRequest().getUserProperties().getProperty( JRUBY_HOME ); } if ( jrubyHome == null ){ jrubyHome = legacySupport.getSession().getRequest().getSystemProperties().getProperty( JRUBY_HOME ); } if ( jrubyHome == null && legacySupport.getSession().getCurrentProject() != null ){ jrubyHome = legacySupport.getSession().getCurrentProject().getProperties().getProperty( JRUBY_HOME ); } if (jrubyHome != null ){ setupFromJrubyHome( jrubyHome, realm ); } else { // use jruby from an artifact doSetupArtifact( gav, realm ); } }
copy.setRecursive( original.isRecursive() ); copy.setPom( original.getPom() ); copy.setSystemProperties( original.getSystemProperties() ); copy.setUserProperties( original.getUserProperties() ); copy.setShowErrors( original.isShowErrors() );
public String getJavaRuntimeVersion() throws MavenException { return maven.createExecutionRequest().getSystemProperties().getProperty(JAVA_RUNTIME_VERSION); }
public Stream<Path> getJreLibs() throws MavenException { return JavaUtils.jreLibs(this::getJavaRuntimeMinorVersion, () -> { try { return maven.createExecutionRequest().getSystemProperties().getProperty(JAVA_HOME); } catch (MavenException e) { log.error("Cannot determine java home", e); return null; } }, () -> { try { return (String) maven.createExecutionRequest().getSystemProperties().get(JAVA_BOOT_CLASS_PATH); } catch (MavenException e) { log.error("Cannot determine boot classpath", e); return null; } } ); }
public static SystemProperties from(LegacySupport legacySupport, MavenRuntime mavenRuntime) { SystemProperties systemProperties = new SystemProperties(); try { MavenProjectProperties projectProperties = mavenRuntime.getProjectProperties(SystemProperties.class); systemProperties.values.put("deadcode4j.version", projectProperties.getVersion()); } catch (MavenRuntimeException e) { LoggerFactory.getLogger(SystemProperties.class).debug("Failed to determine MavenRuntime.", e); } Properties properties = legacySupport.getSession().getRequest().getSystemProperties(); for (String key : KEYS.keySet()) { String property = emptyToNull(properties.getProperty(key)); if (property != null) { systemProperties.values.put(key, property); } } return systemProperties; }
/** * Gets the maven session. * * @return the maven session */ public static MavenSession getMavenSession() { PlexusContainer mock = mock( PlexusContainer.class ); MavenExecutionRequest mer = mock( MavenExecutionRequest.class ); Properties systemProperties = new Properties(); systemProperties.put( "maven.version", "3.0" ); when( mer.getUserProperties() ).thenReturn( new Properties() ); when( mer.getSystemProperties() ).thenReturn( systemProperties ); MavenExecutionResult meresult = mock( MavenExecutionResult.class ); return new MavenSession( mock, (RepositorySystemSession) null, mer, meresult ); }
private void setup( String gav, ClassRealm realm ) throws MalformedURLException { // looking into another JRUBY_HOME is for jruby itself only to allow // jruby build to use itself for bootstraping // see if we have shall use jruby from somewhere else String jrubyHome = System.getenv( "POLYGLOT_JRUBY_HOME" ); if ( jrubyHome == null ){ jrubyHome = System.getProperty( JRUBY_HOME ); } if ( jrubyHome == null ){ jrubyHome = legacySupport.getSession().getRequest().getUserProperties().getProperty( JRUBY_HOME ); } if ( jrubyHome == null ){ jrubyHome = legacySupport.getSession().getRequest().getSystemProperties().getProperty( JRUBY_HOME ); } if ( jrubyHome == null && legacySupport.getSession().getCurrentProject() != null ){ jrubyHome = legacySupport.getSession().getCurrentProject().getProperties().getProperty( JRUBY_HOME ); } if (jrubyHome != null ){ setupFromJrubyHome( jrubyHome, realm ); } else { // use jruby from an artifact doSetupArtifact( gav, realm ); } }
private void setup( String gav, ClassRealm realm ) throws MalformedURLException { // see if we have a jruby-home set somewhere String jrubyHome = System.getenv( "JRUBY_HOME" ); if ( jrubyHome == null ){ jrubyHome = System.getProperty( JRUBY_HOME ); } if ( jrubyHome == null ){ jrubyHome = legacySupport.getSession().getRequest().getUserProperties().getProperty( JRUBY_HOME ); } if ( jrubyHome == null ){ jrubyHome = legacySupport.getSession().getRequest().getSystemProperties().getProperty( JRUBY_HOME ); } if ( jrubyHome == null && legacySupport.getSession().getCurrentProject() != null ){ jrubyHome = legacySupport.getSession().getCurrentProject().getProperties().getProperty( JRUBY_HOME ); } if (jrubyHome != null ){ setupFromJrubyHome( jrubyHome ); } else { // use jruby from an artifact super.setupArtifact( gav, realm ); } }
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; }
EnvironmentUtils.addEnvVars(request.getSystemProperties()); copyProperties(request.getSystemProperties(), System.getProperties());
mavenOpts = mavenSession.getRequest().getSystemProperties().getProperty("MAVEN_OPTS", ""); mavenOpts = mavenSession.getRequest().getSystemProperties().getProperty("env.MAVEN_OPTS", "");
@SuppressWarnings("deprecation") protected MavenExecutionRequest newExecutionRequest() throws Exception { // system properties Properties buildProperties = getMavenBuildProperties(); String mavenVersion = buildProperties.getProperty("version"); Properties systemProperties = new Properties(); systemProperties.putAll(System.getProperties()); // TODO not thread safe systemProperties.setProperty("maven.version", mavenVersion); systemProperties.setProperty("maven.build.version", mavenVersion); // request with initial configuration MavenExecutionRequest request = new DefaultMavenExecutionRequest(); request.setLocalRepositoryPath(properties.getLocalRepository()); request.setUserSettingsFile(properties.getUserSettings()); request.setGlobalSettingsFile(properties.getGlobalSettings()); request.setOffline(properties.getOffline()); request.setUpdateSnapshots(properties.getUpdateSnapshots()); request.setSystemProperties(systemProperties); // read settings SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest(); settingsRequest.setGlobalSettingsFile(request.getGlobalSettingsFile()); settingsRequest.setUserSettingsFile(request.getUserSettingsFile()); settingsRequest.setSystemProperties(request.getSystemProperties()); settingsRequest.setUserProperties(request.getUserProperties()); Settings settings = lookup(SettingsBuilder.class).build(settingsRequest).getEffectiveSettings(); MavenExecutionRequestPopulator populator = container.lookup(MavenExecutionRequestPopulator.class); request = populator.populateFromSettings(request, settings); return populator.populateDefaults(request); }
.getSystemProperties()); settingsRequest.setUserProperties(mavenExecutionRequest .getUserProperties());
this.mavenExecutionRequest.getSystemProperties().putAll(System.getProperties()); if (this.mavenRequest.getSystemProperties() != null) { this.mavenExecutionRequest.getSystemProperties().putAll(this.mavenRequest.getSystemProperties()); this.mavenExecutionRequest.getSystemProperties().putAll(getEnvVars()); this.mavenExecutionRequest.getSystemProperties().put("maven.home", this.mavenHome.getAbsolutePath());
mavenExecutionRequest.getSystemProperties().putAll( System.getProperties() ); if ( mavenRequest.getSystemProperties() != null ) { mavenExecutionRequest.getSystemProperties().putAll( mavenRequest.getSystemProperties() ); mavenExecutionRequest.getSystemProperties().putAll( getEnvVars() );