本文整理汇总了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;
}
示例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;
}
示例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));
}
}
}
示例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);
}
}
}
}
}
}
}
}