本文整理了Java中org.apache.maven.settings.Mirror.getUrl()
方法的一些代码示例,展示了Mirror.getUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mirror.getUrl()
方法的具体详情如下:
包路径:org.apache.maven.settings.Mirror
类名称:Mirror
方法名:getUrl
[英]Get the URL of the mirror repository.
[中]获取镜像存储库的URL。
代码示例来源:origin: apache/maven
@Deprecated
public ArtifactRepository getMirrorRepository( ArtifactRepository repository )
{
Mirror mirror = mirrorSelector.getMirror( repository, legacySupport.getSession().getSettings().getMirrors() );
if ( mirror != null )
{
String id = mirror.getId();
if ( id == null )
{
// TODO this should be illegal in settings.xml
id = repository.getId();
}
log.debug( "Using mirror: " + mirror.getUrl() + " (id: " + id + ")" );
repository = artifactRepositoryFactory.createArtifactRepository( id, mirror.getUrl(),
repository.getLayout(), repository.getSnapshots(),
repository.getReleases() );
}
return repository;
}
代码示例来源:origin: apache/maven
private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
if ( mirror != null )
{
ArtifactRepository original =
createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(),
repository.getSnapshots(), repository.getReleases() );
repository.setMirroredRepositories( Collections.singletonList( original ) );
repository.setId( mirror.getId() );
repository.setUrl( mirror.getUrl() );
if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}
}
}
代码示例来源:origin: apache/maven
private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
if ( mirror != null )
{
ArtifactRepository original =
createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(),
repository.getSnapshots(), repository.getReleases() );
repository.setMirroredRepositories( Collections.singletonList( original ) );
repository.setId( mirror.getId() );
repository.setUrl( mirror.getUrl() );
if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}
}
}
代码示例来源:origin: apache/maven
validateStringNotEmpty( problems, "mirrors.mirror.id", mirror.getId(), mirror.getUrl() );
validateStringNotEmpty( problems, "mirrors.mirror.url", mirror.getUrl(), mirror.getId() );
代码示例来源:origin: apache/maven
if ( mirror.getUrl() != null )
serializer.startTag( NAMESPACE, "url" ).text( mirror.getUrl() ).endTag( NAMESPACE, "url" );
代码示例来源:origin: apache/maven
for ( Mirror mirror : request.getMirrors() )
mirrorSelector.add( mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
mirror.getMirrorOfLayouts() );
代码示例来源:origin: org.apache.maven/maven-settings
if ( mirror.getUrl() != null )
serializer.startTag( NAMESPACE, "url" ).text( mirror.getUrl() ).endTag( NAMESPACE, "url" );
代码示例来源:origin: dsyer/spring-boot-thin-launcher
private String getThinRepo() {
String repo = getProperty("thin.repo");
if (repo != null) {
return repo;
}
for (Mirror mirror : this.settings.getMirrors()) {
String of = mirror.getMirrorOf();
if ("*".equals(of) || "central".equals(of)
|| (of != null && of.contains("spring"))) {
return mirror.getUrl();
}
}
return null;
}
代码示例来源:origin: jetoile/hadoop-unit
private static List<RemoteRepository> getRemoteRepositories() {
String mavenHome = getInstalledMavenHome();
if (StringUtils.isEmpty(mavenHome)) {
return newRepositories();
} else {
List<Mirror> mirrors = getLocalSettings(mavenHome).getMirrors();
if (mirrors.isEmpty()) {
LOGGER.info("no mirror have been defined into maven's configuration. Is going to use {} from maven.central.repo", hadoopUnitConfiguration.getString("maven.central.repo"));
return newRepositories();
}
List<RemoteRepository> remoteRepositories = mirrors.stream().map(mirror -> new RemoteRepository.Builder(mirror.getId(), "default", mirror.getUrl()).build()).collect(Collectors.toList());
return remoteRepositories;
}
}
代码示例来源:origin: io.fabric8/fabric-maven
private MirrorSelector selectMirrors( Mirror mirror ) {
// configure mirror
DefaultMirrorSelector selector = new DefaultMirrorSelector();
for( Mirror m : m_settings.getMirrors() ) {
selector.add( m.getName(), m.getUrl(), null, false, m.getMirrorOf(), "*" );
}
if( mirror != null ) {
selector.add(mirror.getName(), mirror.getUrl(), null, false, mirror.getMirrorOf(), "*");
}
return selector;
}
代码示例来源:origin: io.fabric8/maven-util
/**
* Returns the default {@link MirrorSelector} as configured in the maven settings.xml
*
* @return
*/
public static MirrorSelector getMirrorSelector() {
DefaultMirrorSelector selector = new DefaultMirrorSelector();
Settings settings = getSettings();
for (org.apache.maven.settings.Mirror mirror : settings.getMirrors()) {
selector.add(String.valueOf(mirror.getId()), mirror.getUrl(), mirror.getLayout(), false,
mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
}
return selector;
}
代码示例来源:origin: org.fusesource/maven-util
/**
* Returns the default {@link MirrorSelector} as configured in the maven settings.xml
*
* @return
*/
public static MirrorSelector getMirrorSelector() {
DefaultMirrorSelector selector = new DefaultMirrorSelector();
Settings settings = getSettings();
for (org.apache.maven.settings.Mirror mirror : settings.getMirrors()) {
selector.add(String.valueOf(mirror.getId()), mirror.getUrl(), mirror.getLayout(), false,
mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
}
return selector;
}
代码示例来源:origin: org.eclipse.tycho/tycho-core
@Override
public MavenRepositoryLocation getMirror(MavenRepositoryLocation location) {
if (location.getId() == null) {
return null;
}
// TODO check repository type?
ArtifactRepository locationAsMavenRepository = repositorySystem.createArtifactRepository(location.getId(),
location.getURL().toString(), p2layout, P2_REPOSITORY_POLICY, P2_REPOSITORY_POLICY);
Mirror mirror = mirrorSelector.getMirror(locationAsMavenRepository,
context.getSession().getRequest().getMirrors());
if (mirror != null) {
return new MavenRepositoryLocation(mirror.getId(), URI.create(mirror.getUrl()));
}
return null;
}
代码示例来源:origin: spring-cloud/spring-cloud-function
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;
}
代码示例来源:origin: org.springframework.boot/spring-boot-cli
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;
}
代码示例来源:origin: org.uberfire/uberfire-maven-integration
public RemoteRepository resolveMirroredRepo( RemoteRepository repo ) {
for ( Mirror mirror : settings.getMirrors() ) {
if ( isMirror( repo, mirror.getMirrorOf() ) ) {
return toRemoteRepositoryBuilder( settings,
mirror.getId(),
mirror.getLayout(),
mirror.getUrl() ).build();
}
}
return repo;
}
代码示例来源:origin: org.kie.soup/kie-soup-maven-integration
public RemoteRepository resolveMirroredRepo( RemoteRepository repo ) {
for ( Mirror mirror : settings.getMirrors() ) {
if ( isMirror( repo, mirror.getMirrorOf() ) ) {
return toRemoteRepositoryBuilder( settings,
mirror.getId(),
mirror.getLayout(),
mirror.getUrl() ).build();
}
}
return repo;
}
代码示例来源:origin: org.eclipse.tycho/tycho-core
private Mirror createMirror(ArtifactRepository repo, Mirror toMirror) {
Mirror mirror = toMirror.clone();
String urlToReplace = toMirror.getMirrorOf();
String newUrl = StringUtils.replaceOnce(repo.getUrl(), urlToReplace, toMirror.getUrl());
mirror.setUrl(newUrl);
mirror.setId(toMirror.getId());
return mirror;
}
代码示例来源:origin: org.springframework.boot.experimental/spring-boot-thin-launcher
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;
}
代码示例来源:origin: org.jboss.forge.furnace/furnace-manager-resolver-maven
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;
}
内容来源于网络,如有侵权,请联系作者删除!