当前位置: 首页>>代码示例>>Java>>正文


Java SettingsBuildingRequest类代码示例

本文整理汇总了Java中org.apache.maven.settings.building.SettingsBuildingRequest的典型用法代码示例。如果您正苦于以下问题:Java SettingsBuildingRequest类的具体用法?Java SettingsBuildingRequest怎么用?Java SettingsBuildingRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SettingsBuildingRequest类属于org.apache.maven.settings.building包,在下文中一共展示了SettingsBuildingRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadMavenSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
public static Settings loadMavenSettings()
    throws SettingsBuildingException {
  // http://stackoverflow.com/questions/27818659/loading-mavens-settings-xml-for-jcabi-aether-to-use
  SettingsBuildingRequest settingsBuildingRequest =
      new DefaultSettingsBuildingRequest();
  settingsBuildingRequest.setSystemProperties(System.getProperties());
  settingsBuildingRequest.setUserSettingsFile(new File(settingsXml));
  settingsBuildingRequest.setGlobalSettingsFile(DEFAULT_GLOBAL_SETTINGS_FILE);

  SettingsBuildingResult settingsBuildingResult;
  DefaultSettingsBuilderFactory mvnSettingBuilderFactory =
      new DefaultSettingsBuilderFactory();
  DefaultSettingsBuilder settingsBuilder =
      mvnSettingBuilderFactory.newInstance();
  settingsBuildingResult = settingsBuilder.build(settingsBuildingRequest);

  Settings effectiveSettings = settingsBuildingResult.getEffectiveSettings();
  return effectiveSettings;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:20,代码来源:Utils.java

示例2: loadSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private Settings loadSettings() {
	File settingsFile = new File(this.homeDir, ".m2/settings.xml");
	if (settingsFile.exists()) {
		log.info("Reading settings from: " + settingsFile);
	}
	else {
		log.info("No settings found at: " + settingsFile);
	}
	SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
	request.setUserSettingsFile(settingsFile);
	request.setSystemProperties(System.getProperties());
	try {
		return new DefaultSettingsBuilderFactory().newInstance().build(request)
				.getEffectiveSettings();
	}
	catch (SettingsBuildingException ex) {
		throw new IllegalStateException(
				"Failed to build settings from " + settingsFile, ex);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:21,代码来源:MavenSettingsReader.java

示例3: testCentralWithProfiles

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
@Test
public void testCentralWithProfiles() throws Exception
{
   SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance();
   SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
   settingsRequest.setUserSettingsFile(new File("src/test/resources/profiles/settings.xml"));
   Settings settings = settingsBuilder.build(settingsRequest).getEffectiveSettings();
   MavenContainer container = new MavenContainer();
   List<RemoteRepository> remoteRepositories = MavenRepositories.getRemoteRepositories(container, settings);
   Assert.assertEquals(2, remoteRepositories.size());
   Assert.assertEquals("test-repository", remoteRepositories.get(1).getId());
   
   List<RemoteRepository> centralRepos = remoteRepositories.stream().filter(repo -> repo.getId().equals("central")).collect(Collectors.toList());
   Assert.assertEquals(1, centralRepos.size());
   Assert.assertEquals(MavenRepositories.MAVEN_CENTRAL_REPO, centralRepos.get(0).getUrl());
}
 
开发者ID:forge,项目名称:furnace,代码行数:17,代码来源:MavenRepositoriesTest.java

示例4: newSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
protected static Settings newSettings() throws SettingsBuildingException {
	SettingsBuildingRequest settingsBuildingRequest = new DefaultSettingsBuildingRequest();
	settingsBuildingRequest.setSystemProperties(System.getProperties());
	settingsBuildingRequest.setGlobalSettingsFile(GLOBAL_SETTINGS);
	settingsBuildingRequest.setUserSettingsFile(USER_SETTINGS);
	return (new DefaultSettingsBuilderFactory()).newInstance().build(settingsBuildingRequest)
			.getEffectiveSettings();
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:9,代码来源:Maven.java

示例5: loadSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private Settings loadSettings() {
	File settingsFile = new File(this.homeDir, ".m2/settings.xml");
	SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
	request.setUserSettingsFile(settingsFile);
	request.setSystemProperties(System.getProperties());
	try {
		return new DefaultSettingsBuilderFactory().newInstance().build(request)
				.getEffectiveSettings();
	}
	catch (SettingsBuildingException ex) {
		throw new IllegalStateException(
				"Failed to build settings from " + settingsFile, ex);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:MavenSettingsReader.java

示例6: buildSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private static Settings buildSettings(SettingsBuilder builder,
                                      MavenServerSettings settings,
                                      Properties systemProperties,
                                      Properties userProperties) throws RemoteException {
  SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
  settingsRequest.setGlobalSettingsFile(settings.getGlobalSettingsFile());
  settingsRequest.setUserSettingsFile(settings.getUserSettingsFile());
  settingsRequest.setSystemProperties(systemProperties);
  settingsRequest.setUserProperties(userProperties);

  Settings result = new Settings();
  try {
    result = builder.build(settingsRequest).getEffectiveSettings();
  }
  catch (SettingsBuildingException e) {
    Maven3ServerGlobals.getLogger().info(e);
  }

  result.setOffline(settings.isOffline());

  if (settings.getLocalRepository() != null) {
    result.setLocalRepository(settings.getLocalRepository().getPath());
  }

  if (result.getLocalRepository() == null) {
    result.setLocalRepository(new File(SystemProperties.getUserHome(), ".m2/repository").getPath());
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:Maven30ServerEmbedderImpl.java

示例7: loadSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private Settings loadSettings() {
    File settingsFile = getSettingsFile();
    SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setUserSettingsFile(settingsFile);
    request.setSystemProperties(System.getProperties());
    try {
        return new DefaultSettingsBuilderFactory().newInstance().build(request)
                .getEffectiveSettings();
    }
    catch (SettingsBuildingException ex) {
        throw new IllegalStateException(
                "Failed to build settings from " + settingsFile, ex);
    }
}
 
开发者ID:igor-suhorukov,项目名称:mvn-classloader,代码行数:15,代码来源:MavenSettingsReader.java

示例8: getSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private Settings getSettings(
    SettingsBuilder builder,
    MavenSettings settings,
    Properties systemProperties,
    Properties userProperties)
    throws RemoteException {
  SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
  request.setGlobalSettingsFile(settings.getGlobalSettings());
  request.setUserSettingsFile(settings.getUserSettings());
  request.setSystemProperties(systemProperties);
  request.setUserProperties(userProperties);

  Settings result = new Settings();
  try {
    result = builder.build(request).getEffectiveSettings();
  } catch (SettingsBuildingException e) {
    MavenServerContext.getLogger().info(e);
  }

  result.setOffline(settings.isOffline());
  if (settings.getLocalRepository() != null) {
    result.setLocalRepository(settings.getLocalRepository().getPath());
  }
  if (result.getLocalRepository() == null) {
    result.setLocalRepository(
        new File(System.getProperty("user.home"), ".m2/repository").getPath());
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:MavenServerImpl.java

示例9: buildSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private static Settings buildSettings(SettingsBuilder builder,
                                      MavenServerSettings settings,
                                      Properties systemProperties,
                                      Properties userProperties)
  throws RemoteException {
  SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
  settingsRequest.setGlobalSettingsFile(settings.getGlobalSettingsFile());
  settingsRequest.setUserSettingsFile(settings.getUserSettingsFile());
  settingsRequest.setSystemProperties(systemProperties);
  settingsRequest.setUserProperties(userProperties);

  Settings result = new Settings();
  try {
    result = builder.build(settingsRequest).getEffectiveSettings();
  }
  catch (SettingsBuildingException e) {
    Maven3ServerGlobals.getLogger().info(e);
  }

  result.setOffline(settings.isOffline());

  if (settings.getLocalRepository() != null) {
    result.setLocalRepository(settings.getLocalRepository().getPath());
  }

  if (result.getLocalRepository() == null) {
    result.setLocalRepository(new File(SystemProperties.getUserHome(), ".m2/repository").getPath());
  }

  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:Maven3ServerEmbedderImpl.java

示例10: testMirrorCentralWithoutProfiles

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
@Test
public void testMirrorCentralWithoutProfiles() throws Exception
{
   SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance();
   SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
   settingsRequest.setUserSettingsFile(new File("src/test/resources/profiles/mirror-settings.xml"));
   Settings settings = settingsBuilder.build(settingsRequest).getEffectiveSettings();
   MavenContainer container = new MavenContainer();
   List<RemoteRepository> remoteRepositories = MavenRepositories.getRemoteRepositories(container, settings);
   Assert.assertThat(remoteRepositories.size(), equalTo(1));
   Assert.assertThat(remoteRepositories.get(0).getId(), equalTo("central"));
   Assert.assertThat(remoteRepositories.get(0).getUrl(),
            equalTo("http://repo.cloudbees.com/content/repositories/central/"));
}
 
开发者ID:forge,项目名称:furnace,代码行数:15,代码来源:MavenRepositoriesTest.java

示例11: buildSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
public Settings buildSettings( File userSettingsFile )
    throws IOException, XmlPullParserException
{
    File globalSettingsFile =
        getFile( "${maven.home}/conf/settings.xml", "maven.home",
                 MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION );

    SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
    request.setUserSettingsFile( userSettingsFile );
    request.setGlobalSettingsFile( globalSettingsFile );
    request.setSystemProperties( System.getProperties() );
    return build( request );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:DefaultMavenSettingsBuilder.java

示例12: build

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
private Settings build( SettingsBuildingRequest request )
    throws IOException, XmlPullParserException
{
    try
    {
        return settingsBuilder.build( request ).getEffectiveSettings();
    }
    catch ( SettingsBuildingException e )
    {
        throw (IOException) new IOException( e.getMessage() ).initCause( e );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:13,代码来源:DefaultMavenSettingsBuilder.java

示例13: settings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
/**
 * Provide settings from maven.
 * @return Maven settings.
 */
private Settings settings() {
    final SettingsBuilder builder =
        new DefaultSettingsBuilderFactory().newInstance();
    final SettingsBuildingRequest request =
        new DefaultSettingsBuildingRequest();
    final String user =
        System.getProperty("org.apache.maven.user-settings");
    if (user == null) {
        request.setUserSettingsFile(
            new File(
                new File(
                    System.getProperty("user.home")
                ).getAbsoluteFile(),
                "/.m2/settings.xml"
            )
        );
    } else {
        request.setUserSettingsFile(new File(user));
    }
    final String global =
        System.getProperty("org.apache.maven.global-settings");
    if (global != null) {
        request.setGlobalSettingsFile(new File(global));
    }
    final SettingsBuildingResult result;
    try {
        result = builder.build(request);
    } catch (final SettingsBuildingException ex) {
        throw new IllegalStateException(ex);
    }
    return this.invokers(builder, result);
}
 
开发者ID:jcabi,项目名称:jcabi-aether,代码行数:37,代码来源:Aether.java

示例14: onEvent

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
@Override
public void onEvent(Object event) throws Exception {
	
	if (event instanceof SettingsBuildingRequest) {
		SettingsBuildingRequest settingBuildingRequest = (SettingsBuildingRequest) event;
		userSettingFile = settingBuildingRequest.getUserSettingsFile();
		globalSettingFile = settingBuildingRequest.getGlobalSettingsFile();
	}
	
	if (event instanceof MavenExecutionRequest) {
		MavenExecutionRequest mer = (MavenExecutionRequest) event;
		debug = (mer.getLoggingLevel() == MavenExecutionRequest.LOGGING_LEVEL_DEBUG);
		context.getData().put("baseAdd",mer.getBaseDirectory());
	}
	
	if (event instanceof ExecutionEvent) {

		ExecutionEvent executionEvent = (ExecutionEvent) event;

		if (executionEvent.getType() == ExecutionEvent.Type.ProjectDiscoveryStarted) {
			discoveryProfile = new DiscoveryProfile(context, executionEvent, userSettingFile, globalSettingFile,debug);

		} else if (executionEvent.getType() == ExecutionEvent.Type.SessionStarted) {
			sessionProfile = new SessionProfile(context, executionEvent, debug);
		} else if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
			projectProfile.addPhaseProfile(phaseProfile);
			
			//if can accelerate,we will not generate the dependency file
			
			sessionProfile.stop();
			discoveryProfile.stop();
			OutputRenderer renderer = new OutputRenderer(sessionProfile, discoveryProfile);
			renderer.renderToScreen();
			// renderer.renderToJSON();
		} else if (executionEvent.getType() == ExecutionEvent.Type.ProjectStarted) {
			projectProfile = new ProjectProfile(context, executionEvent.getProject(), executionEvent);
		} else if (executionEvent.getType() == ExecutionEvent.Type.ProjectSucceeded
				|| executionEvent.getType() == ExecutionEvent.Type.ProjectFailed) {

			if (phaseProfile != null)
				phaseProfile.stop();
			projectProfile.stop();
			sessionProfile.addProjectProfile(projectProfile);
		} else if (executionEvent.getType() == ExecutionEvent.Type.MojoStarted) {
			String phase = executionEvent.getMojoExecution()
					.getLifecyclePhase();
			if (phaseProfile == null) {
				phaseProfile = new PhaseProfile(context, phase, executionEvent);
			} else if (phase == null) {
				phaseProfile.stop();
				projectProfile.addPhaseProfile(phaseProfile);
				phaseProfile = new PhaseProfile(context, "default", executionEvent);
			} else if (!phase.equals(phaseProfile.getPhase())) {
				phaseProfile.stop();
				projectProfile.addPhaseProfile(phaseProfile);
				phaseProfile = new PhaseProfile(context, phase, executionEvent);
			}
			mojoProfile = new MojoProfile(context, executionEvent.getMojoExecution(), executionEvent);
		} else if (executionEvent.getType() == ExecutionEvent.Type.MojoSucceeded
				|| executionEvent.getType() == ExecutionEvent.Type.MojoFailed) {
			mojoProfile.stop();
			phaseProfile.addMojoProfile(mojoProfile);
		}
	}
}
 
开发者ID:eBay,项目名称:mTracker,代码行数:66,代码来源:MavenLifecycleProfiler.java

示例15: getSettings

import org.apache.maven.settings.building.SettingsBuildingRequest; //导入依赖的package包/类
public Settings getSettings()
{
   try
   {
      SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance();
      SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
      String userSettingsLocation = System.getProperty(ALT_USER_SETTINGS_XML_LOCATION);
      // TeamCity sets the settings.xml in a different system property
      String teamCitySettingsLocation = System.getProperty("teamcity.maven.userSettings.path");
      if (userSettingsLocation != null)
      {
         settingsRequest.setUserSettingsFile(new File(userSettingsLocation));
      }
      else if (teamCitySettingsLocation != null)
      {
         settingsRequest.setUserSettingsFile(new File(teamCitySettingsLocation));
      }
      else
      {
         settingsRequest.setUserSettingsFile(new File(getUserHomeDir(), "/.m2/settings.xml"));
      }
      String globalSettingsLocation = System.getProperty(ALT_GLOBAL_SETTINGS_XML_LOCATION);
      if (globalSettingsLocation != null)
      {
         settingsRequest.setGlobalSettingsFile(new File(globalSettingsLocation));
      }
      else
      {
         if (M2_HOME != null)
         {
            settingsRequest.setGlobalSettingsFile(new File(M2_HOME, "/conf/settings.xml"));
         }
      }
      SettingsBuildingResult settingsBuildingResult = settingsBuilder.build(settingsRequest);
      Settings effectiveSettings = settingsBuildingResult.getEffectiveSettings();

      if (effectiveSettings.getLocalRepository() == null)
      {
         String userRepositoryLocation = System.getProperty(ALT_LOCAL_REPOSITORY_LOCATION);
         if (userRepositoryLocation != null)
         {
            effectiveSettings.setLocalRepository(userRepositoryLocation);
         }
         else
         {
            effectiveSettings.setLocalRepository(getUserHomePath() + "/.m2/repository");
         }
      }

      return effectiveSettings;
   }
   catch (SettingsBuildingException e)
   {
      throw new RuntimeException(e);
   }
}
 
开发者ID:forge,项目名称:furnace,代码行数:57,代码来源:MavenContainer.java


注:本文中的org.apache.maven.settings.building.SettingsBuildingRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。