本文整理汇总了Java中org.apache.maven.settings.Settings.getMirrors方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getMirrors方法的具体用法?Java Settings.getMirrors怎么用?Java Settings.getMirrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.Settings
的用法示例。
在下文中一共展示了Settings.getMirrors方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMirrorInfo
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
/**
* if the repository has a mirror, then create a repositoryinfo object for it..
*/
private RepositoryInfo getMirrorInfo(RepositoryInfo info, MirrorSelector selector, Settings settings) {
RemoteRepository original = new RemoteRepository.Builder(info.getId(), /* XXX do we even support any other layout?*/"default", info.getRepositoryUrl()).build();
RemoteRepository mirror = selector.getMirror(original);
if (mirror != null) {
try {
String name = mirror.getId();
//#213078 need to lookup name for mirror
for (Mirror m : settings.getMirrors()) {
if (m.getId() != null && m.getId().equals(mirror.getId())) {
name = m.getName();
break;
}
}
RepositoryInfo toret = new RepositoryInfo(mirror.getId(), name, null, mirror.getUrl());
toret.setMirrorStrategy(RepositoryInfo.MirrorStrategy.NONE);
return toret;
} catch (URISyntaxException ex) {
Exceptions.printStackTrace(ex);
}
}
return null;
}
示例2: createMirrorSelector
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private MirrorSelector createMirrorSelector(Settings settings) {
DefaultMirrorSelector selector = new DefaultMirrorSelector();
for (Mirror mirror : settings.getMirrors()) {
selector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false,
mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
}
return selector;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:MavenSettings.java
示例3: createMirrorSelector
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private DefaultMirrorSelector createMirrorSelector(Settings settings)
{
final DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
final List<Mirror> mirrors = settings.getMirrors();
if (mirrors != null)
{
for (Mirror mirror : mirrors)
{
mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
mirror.getMirrorOfLayouts());
}
}
return mirrorSelector;
}
示例4: addRequestRepositoriesTo
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private void addRequestRepositoriesTo( final Set<Location> locs,
final List<ArtifactRepository> artifactRepositories,
final Settings settings, final MirrorSelector mirrorSelector )
throws MalformedURLException
{
if ( artifactRepositories != null )
{
for ( final ArtifactRepository repo : artifactRepositories )
{
// TODO: Authentication via memory password manager.
String id = repo.getId();
String url = repo.getUrl();
if ( url.startsWith( "file:" ) )
{
locs.add( new SimpleLocation( id, url ) );
}
else
{
final List<Mirror> mirrors = settings.getMirrors();
if ( mirrors != null )
{
final Mirror mirror = mirrorSelector == null ? null : mirrorSelector.getMirror( repo, mirrors );
if ( mirror != null )
{
id = mirror.getId();
url = mirror.getUrl();
}
}
final ArtifactRepositoryPolicy releases = repo.getReleases();
final ArtifactRepositoryPolicy snapshots = repo.getSnapshots();
SimpleHttpLocation addition = new SimpleHttpLocation( id, url,
snapshots != null && snapshots.isEnabled(),
releases == null || releases.isEnabled(), true, false,
null );
addition.setAttribute(Location.CONNECTION_TIMEOUT_SECONDS, 60);
locs.add (addition);
}
}
}
}
示例5: 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);
}
}
}
}
}
}
}
}
示例6: populateFromSettings
import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
throws MavenExecutionRequestPopulationException
{
if ( settings == null )
{
return request;
}
request.setOffline( settings.isOffline() );
request.setInteractiveMode( settings.isInteractiveMode() );
request.setPluginGroups( settings.getPluginGroups() );
request.setLocalRepositoryPath( settings.getLocalRepository() );
for ( Server server : settings.getServers() )
{
server = server.clone();
request.addServer( server );
}
// <proxies>
// <proxy>
// <active>true</active>
// <protocol>http</protocol>
// <host>proxy.somewhere.com</host>
// <port>8080</port>
// <username>proxyuser</username>
// <password>somepassword</password>
// <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
// </proxy>
// </proxies>
for ( Proxy proxy : settings.getProxies() )
{
if ( !proxy.isActive() )
{
continue;
}
proxy = proxy.clone();
request.addProxy( proxy );
}
// <mirrors>
// <mirror>
// <id>nexus</id>
// <mirrorOf>*</mirrorOf>
// <url>http://repository.sonatype.org/content/groups/public</url>
// </mirror>
// </mirrors>
for ( Mirror mirror : settings.getMirrors() )
{
mirror = mirror.clone();
request.addMirror( mirror );
}
request.setActiveProfiles( settings.getActiveProfiles() );
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
{
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
}
return request;
}