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


Java Profile.getRepositories方法代码示例

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


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

示例1: getRepositoryList

import org.apache.maven.settings.Profile; //导入方法依赖的package包/类
public static List<RemoteRepository> getRepositoryList() throws SettingsBuildingException {
  
  List<RemoteRepository> repos = new ArrayList<RemoteRepository>();
  
  RemoteRepository central =
      new RemoteRepository.Builder("central", "default",
              "http://repo1.maven.org/maven2/").build();
  
  // Without this we wouldn't be able to find SNAPSHOT builds of plugins we
  // haven't built and installed locally ourselves
  RemoteRepository gateRepo = new RemoteRepository.Builder("gate", "default",
      "http://repo.gate.ac.uk/content/groups/public/").build();

  // Add all repos from settings.xml
  // http://stackoverflow.com/questions/27818659/loading-mavens-settings-xml-for-jcabi-aether-to-use
  Settings effectiveSettings = loadMavenSettings();
  Map<String, Profile> profilesMap = effectiveSettings.getProfilesAsMap();
  for(String profileName : effectiveSettings.getActiveProfiles()) {
    Profile profile = profilesMap.get(profileName);
    List<Repository> repositories = profile.getRepositories();
    for(Repository repo : repositories) {
      RemoteRepository remoteRepo =
              new RemoteRepository.Builder(repo.getId(), "default",
                      repo.getUrl()).build();
    repos.add(remoteRepo);
    }
  }
  
  repos.add(central);    
  repos.add(gateRepo);
  
  return repos;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:34,代码来源:Utils.java

示例2: addActiveProfileRepositories

import org.apache.maven.settings.Profile; //导入方法依赖的package包/类
private static void addActiveProfileRepositories(List<Profile> activeProfiles,
		List<RepositoryConfiguration> configurations) {
	for (Profile activeProfile : activeProfiles) {
		Interpolator interpolator = new RegexBasedInterpolator();
		interpolator.addValueSource(
				new PropertiesBasedValueSource(activeProfile.getProperties()));
		for (Repository repository : activeProfile.getRepositories()) {
			configurations.add(getRepositoryConfiguration(interpolator, repository));
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:RepositoryConfigurationFactory.java

示例3: mavenRepositories

import org.apache.maven.settings.Profile; //导入方法依赖的package包/类
private Collection<? extends ArtifactRepository> mavenRepositories(
		MavenSettings settings) {
	List<ArtifactRepository> list = new ArrayList<>();
	for (Profile profile : settings.getActiveProfiles()) {
		for (Repository repository : profile.getRepositories()) {
			addRepositoryIfMissing(list, repository.getId(), repository.getUrl(),
					repository.getReleases() != null
							? repository.getReleases().isEnabled() : true,
					repository.getSnapshots() != null
							? repository.getSnapshots().isEnabled() : false);
		}
	}
	return list;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:15,代码来源:DependencyResolver.java

示例4: addActiveProfileRepositories

import org.apache.maven.settings.Profile; //导入方法依赖的package包/类
private static void addActiveProfileRepositories(List<Profile> activeProfiles,
		List<RepositoryConfiguration> repositoryConfiguration) {
	for (Profile activeProfile : activeProfiles) {
		for (Repository repository : activeProfile.getRepositories()) {
			repositoryConfiguration.add(new RepositoryConfiguration(
					repository.getId(), URI.create(repository.getUrl()),
					repository.getSnapshots() != null
							? repository.getSnapshots().isEnabled() : false));
		}
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:12,代码来源:RepositoryConfigurationFactory.java

示例5: addSettingsProfileRepositoriesTo

import org.apache.maven.settings.Profile; //导入方法依赖的package包/类
private void addSettingsProfileRepositoriesTo( final Set<Location> locs, final Settings settings,
                                               final List<String> activeProfiles,
                                               final MirrorSelector mirrorSelector )
    throws MalformedURLException
{
    if ( settings != null )
    {
        final Map<String, Profile> profiles = settings.getProfilesAsMap();
        if ( profiles != null && activeProfiles != null && !activeProfiles.isEmpty() )
        {
            final LinkedHashSet<String> active = new LinkedHashSet<>( activeProfiles );

            final List<String> settingsActiveProfiles = settings.getActiveProfiles();
            if ( settingsActiveProfiles != null && !settingsActiveProfiles.isEmpty() )
            {
                active.addAll( settingsActiveProfiles );
            }

            for ( final String profileId : active )
            {
                final Profile profile = profiles.get( profileId );
                if ( profile != null )
                {
                    final List<Repository> repositories = profile.getRepositories();
                    if ( repositories != null )
                    {
                        final List<Mirror> mirrors = settings.getMirrors();
                        final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
                        for ( final Repository repo : repositories )
                        {
                            String id = repo.getId();
                            String url = repo.getUrl();

                            if ( mirrors != null )
                            {
                                final ArtifactRepositoryPolicy snapshots = convertPolicy( repo.getSnapshots() );
                                final ArtifactRepositoryPolicy releases = convertPolicy( repo.getReleases() );

                                final MavenArtifactRepository arepo =
                                    new MavenArtifactRepository( id, url, layout, snapshots, releases );

                                final Mirror mirror =
                                    mirrorSelector == null ? null : mirrorSelector.getMirror( arepo, mirrors );

                                if ( mirror != null )
                                {
                                    id = mirror.getId();
                                    url = mirror.getUrl();
                                }

                                SimpleHttpLocation addition = new SimpleHttpLocation( id, url, snapshots.isEnabled(), releases.isEnabled(), true, false, null );

                                addition.setAttribute(Location.CONNECTION_TIMEOUT_SECONDS, 60);

                                locs.add (addition);
                            }
                        }
                    }

                }
            }
        }
    }
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:65,代码来源:MavenLocationExpander.java


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