Search in sources :

Example 16 with DefaultSettingsBuildingRequest

use of org.apache.maven.settings.building.DefaultSettingsBuildingRequest in project gradle by gradle.

the class DefaultMavenSettingsProvider method buildSettings.

/**
 * Builds a complete `Settings` instance for this machine.
 *
 * Note that this can be an expensive operation, spawning an external process
 * and doing a bunch of additional processing.
 */
@Override
public Settings buildSettings() throws SettingsBuildingException {
    DefaultSettingsBuilderFactory factory = new DefaultSettingsBuilderFactory();
    DefaultSettingsBuilder defaultSettingsBuilder = factory.newInstance();
    DefaultSettingsBuildingRequest settingsBuildingRequest = new DefaultSettingsBuildingRequest();
    settingsBuildingRequest.setSystemProperties(System.getProperties());
    settingsBuildingRequest.setUserSettingsFile(mavenFileLocations.getUserSettingsFile());
    settingsBuildingRequest.setGlobalSettingsFile(mavenFileLocations.getGlobalSettingsFile());
    SettingsBuildingResult settingsBuildingResult = defaultSettingsBuilder.build(settingsBuildingRequest);
    return settingsBuildingResult.getEffectiveSettings();
}
Also used : DefaultSettingsBuildingRequest(org.apache.maven.settings.building.DefaultSettingsBuildingRequest) SettingsBuildingResult(org.apache.maven.settings.building.SettingsBuildingResult) DefaultSettingsBuilder(org.apache.maven.settings.building.DefaultSettingsBuilder) DefaultSettingsBuilderFactory(org.apache.maven.settings.building.DefaultSettingsBuilderFactory)

Aggregations

DefaultSettingsBuildingRequest (org.apache.maven.settings.building.DefaultSettingsBuildingRequest)16 Settings (org.apache.maven.settings.Settings)12 SettingsBuildingException (org.apache.maven.settings.building.SettingsBuildingException)12 SettingsBuildingRequest (org.apache.maven.settings.building.SettingsBuildingRequest)11 File (java.io.File)10 DefaultSettingsBuilderFactory (org.apache.maven.settings.building.DefaultSettingsBuilderFactory)8 SettingsBuildingResult (org.apache.maven.settings.building.SettingsBuildingResult)6 DefaultSettingsBuilder (org.apache.maven.settings.building.DefaultSettingsBuilder)5 Profile (org.apache.maven.settings.Profile)3 Server (org.apache.maven.settings.Server)3 SettingsBuilder (org.apache.maven.settings.building.SettingsBuilder)3 IOException (java.io.IOException)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)1 MavenServerRule (com.google.devtools.build.lib.bazel.rules.workspace.MavenServerRule)1 Rule (com.google.devtools.build.lib.packages.Rule)1 RepositoryFunctionException (com.google.devtools.build.lib.rules.repository.RepositoryFunction.RepositoryFunctionException)1 RepositoryNotFoundException (com.google.devtools.build.lib.rules.repository.RepositoryFunction.RepositoryNotFoundException)1 WorkspaceAttributeMapper (com.google.devtools.build.lib.rules.repository.WorkspaceAttributeMapper)1 FileValue (com.google.devtools.build.lib.skyframe.FileValue)1