Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
maven-compat-3.8.6.jar - Maven Compact Module
maven-compat-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Compact module.
The JAR file name may have a typo.
Apache Maven is a software project management and comprehension tool.
JAR File Size and Download Location:
File: 288125 06-06-2022 16:16 lib/maven-compat-3.8.6.jar Download: Apache Maven Website
✍: FYIcenter.com
⏎ org/apache/maven/repository/DefaultMirrorSelector.java
package org.apache.maven.repository; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.net.MalformedURLException; import java.net.URL; import java.util.List; import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.settings.Mirror; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.StringUtils; /** * DefaultMirrorSelector */ @Component( role = MirrorSelector.class ) public class DefaultMirrorSelector implements MirrorSelector { private static final String WILDCARD = "*"; private static final String EXTERNAL_WILDCARD = "external:*"; private static final String EXTERNAL_HTTP_WILDCARD = "external:http:*"; public Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors ) { String repoId = repository.getId(); if ( repoId != null && mirrors != null ) { for ( Mirror mirror : mirrors ) { if ( repoId.equals( mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) ) { return mirror; } } for ( Mirror mirror : mirrors ) { if ( matchPattern( repository, mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) ) { return mirror; } } } return null; } /** * This method checks if the pattern matches the originalRepository. Valid patterns: * <ul> * <li>{@code *} = everything,</li> * <li>{@code external:*} = everything not on the localhost and not file based,</li> * <li>{@code external:http:*} = any repository not on the localhost using HTTP,</li> * <li>{@code repo,repo1} = {@code repo} or {@code repo1},</li> * <li>{@code *,!repo1} = everything except {@code repo1}.</li> * </ul> * * @param originalRepository to compare for a match. * @param pattern used for match. Currently only '*' is supported. * @return true if the repository is a match to this pattern. */ static boolean matchPattern( ArtifactRepository originalRepository, String pattern ) { boolean result = false; String originalId = originalRepository.getId(); // simple checks first to short circuit processing below. if ( WILDCARD.equals( pattern ) || pattern.equals( originalId ) ) { result = true; } else { // process the list String[] repos = pattern.split( "," ); for ( String repo : repos ) { repo = repo.trim(); // see if this is a negative match if ( repo.length() > 1 && repo.startsWith( "!" ) ) { if ( repo.substring( 1 ).equals( originalId ) ) { // explicitly exclude. Set result and stop processing. result = false; break; } } // check for exact match else if ( repo.equals( originalId ) ) { result = true; break; } // check for external:* else if ( EXTERNAL_WILDCARD.equals( repo ) && isExternalRepo( originalRepository ) ) { result = true; // don't stop processing in case a future segment explicitly excludes this repo } // check for external:http:* else if ( EXTERNAL_HTTP_WILDCARD.equals( repo ) && isExternalHttpRepo( originalRepository ) ) { result = true; // don't stop processing in case a future segment explicitly excludes this repo } else if ( WILDCARD.equals( repo ) ) { result = true; // don't stop processing in case a future segment explicitly excludes this repo } } } return result; } /** * Checks the URL to see if this repository refers to an external repository * * @param originalRepository * @return true if external. */ static boolean isExternalRepo( ArtifactRepository originalRepository ) { try { URL url = new URL( originalRepository.getUrl() ); return !( isLocal( url.getHost() ) || url.getProtocol().equals( "file" ) ); } catch ( MalformedURLException e ) { // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it return false; } } private static boolean isLocal( String host ) { return "localhost".equals( host ) || "127.0.0.1".equals( host ); } /** * Checks the URL to see if this repository refers to a non-localhost repository using HTTP. * * @param originalRepository * @return true if external. */ static boolean isExternalHttpRepo( ArtifactRepository originalRepository ) { try { URL url = new URL( originalRepository.getUrl() ); return ( "http".equalsIgnoreCase( url.getProtocol() ) || "dav".equalsIgnoreCase( url.getProtocol() ) || "dav:http".equalsIgnoreCase( url.getProtocol() ) || "dav+http".equalsIgnoreCase( url.getProtocol() ) ) && !isLocal( url.getHost() ); } catch ( MalformedURLException e ) { // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it return false; } } static boolean matchesLayout( ArtifactRepository repository, Mirror mirror ) { return matchesLayout( RepositoryUtils.getLayout( repository ), mirror.getMirrorOfLayouts() ); } /** * Checks whether the layouts configured for a mirror match with the layout of the repository. * * @param repoLayout The layout of the repository, may be {@code null}. * @param mirrorLayout The layouts supported by the mirror, may be {@code null}. * @return {@code true} if the layouts associated with the mirror match the layout of the original repository, * {@code false} otherwise. */ static boolean matchesLayout( String repoLayout, String mirrorLayout ) { boolean result = false; // simple checks first to short circuit processing below. if ( StringUtils.isEmpty( mirrorLayout ) || WILDCARD.equals( mirrorLayout ) ) { result = true; } else if ( mirrorLayout.equals( repoLayout ) ) { result = true; } else { // process the list String[] layouts = mirrorLayout.split( "," ); for ( String layout : layouts ) { // see if this is a negative match if ( layout.length() > 1 && layout.startsWith( "!" ) ) { if ( layout.substring( 1 ).equals( repoLayout ) ) { // explicitly exclude. Set result and stop processing. result = false; break; } } // check for exact match else if ( layout.equals( repoLayout ) ) { result = true; break; } else if ( WILDCARD.equals( layout ) ) { result = true; // don't stop processing in case a future segment explicitly excludes this repo } } } return result; } }
⏎ org/apache/maven/repository/DefaultMirrorSelector.java
Or download all of them as a single archive file:
File name: maven-compat-3.8.6-src.zip File size: 215809 bytes Release date: 2022-06-06 Download
⇒ maven-embedder-3.8.6.jar - Maven Embedder Module
⇐ maven-builder-support-3.8.6.jar - Builder Support Module
2020-10-26, 55780👍, 0💬
Popular Posts:
What Is ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is the JAR files of ojdbc.jar, JD...
The Jakarta-ORO Java classes are a set of text-processing Java classes that provide Perl5 compatible...
What Is HttpComponents httpcore-4.2.2.jar? HttpComponents httpcore-4.2.2.jar is the JAR file for Apa...
XStream is a simple library to serialize objects to XML and back again. JAR File Size and Download L...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...