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


Java Settings.addProfile方法代码示例

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


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

示例1: transformSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
/**
 * Recieves artifactories MavenSettings object and transforms it to maven's Settings object
 *
 * @param mavenSettings Settings to transform
 * @return Settings - Transformed settings
 */
private Settings transformSettings(MavenSettings mavenSettings) {
    String contextUrl = mavenSettings.getUrl();

    Settings settings = new Settings();

    Profile profile = new Profile();
    profile.setId("artifactory");

    //Add plugin and releases repositories to the profile
    addReleaseRepositories(contextUrl, profile, mavenSettings.getReleaseRepositories());
    addPluginRepositories(contextUrl, profile, mavenSettings.getPluginRepositories());
    settings.addProfile(profile);
    settings.setActiveProfiles(Collections.singletonList(profile.getId()));

    //Add mirrors to the settings
    addMirrors(contextUrl, settings, mavenSettings.getMirrorRepositories());

    addServers(settings, mavenSettings.getServers());

    return settings;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:28,代码来源:MavenServiceImpl.java

示例2: testValidate

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public void testValidate()
{
    Settings model = new Settings();
    Profile prof = new Profile();
    prof.setId( "xxx" );
    model.addProfile( prof );
    SimpleProblemCollector problems = new SimpleProblemCollector();
    validator.validate( model, problems );
    assertEquals( 0, problems.messages.size() );

    Repository repo = new Repository();
    prof.addRepository( repo );
    problems = new SimpleProblemCollector();
    validator.validate( model, problems );
    assertEquals( 2, problems.messages.size() );

    repo.setUrl( "http://xxx.xxx.com" );
    problems = new SimpleProblemCollector();
    validator.validate( model, problems );
    assertEquals( 1, problems.messages.size() );

    repo.setId( "xxx" );
    problems = new SimpleProblemCollector();
    validator.validate( model, problems );
    assertEquals( 0, problems.messages.size() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:DefaultSettingsValidatorTest.java

示例3: testValidateUniqueProfileId

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public void testValidateUniqueProfileId()
    throws Exception
{
    Settings settings = new Settings();
    Profile profile1 = new Profile();
    profile1.setId( "test" );
    settings.addProfile( profile1 );
    Profile profile2 = new Profile();
    profile2.setId( "test" );
    settings.addProfile( profile2 );

    SimpleProblemCollector problems = new SimpleProblemCollector();
    validator.validate( settings, problems );
    assertEquals( 1, problems.messages.size() );
    assertContains( problems.messages.get( 0 ),
                    "'profiles.profile.id' must be unique but found duplicate profile with id test" );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:DefaultSettingsValidatorTest.java

示例4: testValidateUniqueRepositoryId

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public void testValidateUniqueRepositoryId()
    throws Exception
{
    Settings settings = new Settings();
    Profile profile = new Profile();
    profile.setId( "pro" );
    settings.addProfile( profile );
    Repository repo1 = new Repository();
    repo1.setUrl( "http://apache.org/" );
    repo1.setId( "test" );
    profile.addRepository( repo1 );
    Repository repo2 = new Repository();
    repo2.setUrl( "http://apache.org/" );
    repo2.setId( "test" );
    profile.addRepository( repo2 );

    SimpleProblemCollector problems = new SimpleProblemCollector();
    validator.validate( settings, problems );
    assertEquals( 1, problems.messages.size() );
    assertContains( problems.messages.get( 0 ), "'profiles.profile[pro].repositories.repository.id' must be unique"
        + " but found duplicate repository with id test" );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:DefaultSettingsValidatorTest.java

示例5: useActiveSettingsProfileRepos

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
@Test
public void useActiveSettingsProfileRepos()
    throws Exception
{
    final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();

    final ArtifactRepositoryPolicy snapshots =
        new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY,
                                      ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );

    final ArtifactRepositoryPolicy releases =
        new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER,
                                      ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );

    final File localRepo = File.createTempFile( "local.repo.", ".dir" );
    localRepo.deleteOnExit();

    final ArtifactRepository local =
        new MavenArtifactRepository( "local", localRepo.toURI()
                                                       .toString(), layout, snapshots, releases );

    final Repository remote = new Repository();
    remote.setId( "remote" );
    remote.setUrl( "http:///repo.maven.apache.org/maven2" );

    final Profile profile = new Profile();
    profile.setId( "test" );
    profile.addRepository( remote );

    final Settings settings = new Settings();
    settings.addProfile( profile );

    final MavenLocationExpander ex =
        new MavenLocationExpander( Collections.<Location> emptyList(),
                                   Collections.<ArtifactRepository> emptyList(), local,
                                   new DefaultMirrorSelector(), settings,
                                   Collections.<String> singletonList( profile.getId() ) );

    final List<Location> result = ex.expand( MavenLocationExpander.EXPANSION_TARGET );

    assertThat( result.size(), equalTo( 2 ) );

    final Iterator<Location> iterator = result.iterator();
    Location loc = iterator.next();

    assertThat( loc.getName(), equalTo( local.getId() ) );
    assertThat( loc.getUri(), equalTo( local.getUrl() ) );

    loc = iterator.next();

    assertThat( loc.getName(), equalTo( remote.getId() ) );
    assertThat( loc.getUri(), equalTo( remote.getUrl() ) );
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:54,代码来源:MavenLocationExpanderTest.java


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