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


Java SettingsBuilder.build方法代码示例

本文整理汇总了Java中org.apache.maven.settings.building.SettingsBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java SettingsBuilder.build方法的具体用法?Java SettingsBuilder.build怎么用?Java SettingsBuilder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.settings.building.SettingsBuilder的用法示例。


在下文中一共展示了SettingsBuilder.build方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: settings

import org.apache.maven.settings.building.SettingsBuilder; //导入方法依赖的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

示例2: getSettings

import org.apache.maven.settings.building.SettingsBuilder; //导入方法依赖的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.SettingsBuilder.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。