本文整理汇总了Java中org.apache.maven.settings.Settings.getProfilesAsMap方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getProfilesAsMap方法的具体用法?Java Settings.getProfilesAsMap怎么用?Java Settings.getProfilesAsMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.Settings
的用法示例。
在下文中一共展示了Settings.getProfilesAsMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: determineActiveProfiles
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private List<Profile> determineActiveProfiles(Settings settings) {
SpringBootCliModelProblemCollector problemCollector = new SpringBootCliModelProblemCollector();
List<org.apache.maven.model.Profile> activeModelProfiles = createProfileSelector()
.getActiveProfiles(createModelProfiles(settings.getProfiles()),
new SpringBootCliProfileActivationContext(
settings.getActiveProfiles()),
problemCollector);
if (!problemCollector.getProblems().isEmpty()) {
throw new IllegalStateException(createFailureMessage(problemCollector));
}
List<Profile> activeProfiles = new ArrayList<Profile>();
Map<String, Profile> profiles = settings.getProfilesAsMap();
for (org.apache.maven.model.Profile modelProfile : activeModelProfiles) {
activeProfiles.add(profiles.get(modelProfile.getId()));
}
return activeProfiles;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:MavenSettings.java
示例2: getRepositoryList
import org.apache.maven.settings.Settings; //导入方法依赖的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;
}
示例3: newRemoteRepositories
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
protected static List<RemoteRepository> newRemoteRepositories(Settings settings) {
Map<String, Profile> profiles = settings.getProfilesAsMap();
List<RemoteRepository> remoteRepositories = settings.getActiveProfiles().stream().map(activeProfile -> {
if (!profiles.containsKey(activeProfile)) {
throw new RuntimeException("Activate profile " + activeProfile + " is not defined");
}
return profiles.get(activeProfile);
}).map(Profile::getRepositories).flatMap(Collection::stream).map(
repository -> new RemoteRepository.Builder(repository.getId(), "default", repository.getUrl()).build())
.collect(Collectors.toList());
if (!remoteRepositories.isEmpty()) {
return remoteRepositories;
}
return Lists.newArrayList(DEFAULT_REMOTE_REPOSITORY);
}
示例4: addSettingsProfileRepositoriesTo
import org.apache.maven.settings.Settings; //导入方法依赖的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);
}
}
}
}
}
}
}
}