本文整理匯總了Java中org.apache.maven.repository.internal.MavenRepositorySystemUtils類的典型用法代碼示例。如果您正苦於以下問題:Java MavenRepositorySystemUtils類的具體用法?Java MavenRepositorySystemUtils怎麽用?Java MavenRepositorySystemUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MavenRepositorySystemUtils類屬於org.apache.maven.repository.internal包,在下文中一共展示了MavenRepositorySystemUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DummyAetherRepository
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public DummyAetherRepository(Path baseTempDir) throws IOException {
tempDir = Files.createTempDirectory(baseTempDir, getClass().getSimpleName());
try {
jaxbContext = JAXBContext.newInstance(MutableBundle.class);
} catch (JAXBException exception) {
throw new IllegalStateException("Failed to create JAXB context.", exception);
}
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
repositorySystem = locator.getService(RepositorySystem.class);
repositorySystemSession = MavenRepositorySystemUtils.newSession();
localRepository
= new LocalRepository(Files.createTempDirectory(tempDir, "maven-repo").toFile(), SIMPLE_REPOSITORY_MANAGER);
repositorySystemSession.setLocalRepositoryManager(
repositorySystem.newLocalRepositoryManager(repositorySystemSession, localRepository)
);
}
示例2: create
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public static AetherGrapeEngine create(GroovyClassLoader classLoader,
List<RepositoryConfiguration> repositoryConfigurations,
DependencyResolutionContext dependencyResolutionContext) {
RepositorySystem repositorySystem = createServiceLocator()
.getService(RepositorySystem.class);
DefaultRepositorySystemSession repositorySystemSession = MavenRepositorySystemUtils
.newSession();
ServiceLoader<RepositorySystemSessionAutoConfiguration> autoConfigurations = ServiceLoader
.load(RepositorySystemSessionAutoConfiguration.class);
for (RepositorySystemSessionAutoConfiguration autoConfiguration : autoConfigurations) {
autoConfiguration.apply(repositorySystemSession, repositorySystem);
}
new DefaultRepositorySystemSessionAutoConfiguration()
.apply(repositorySystemSession, repositorySystem);
return new AetherGrapeEngine(classLoader, repositorySystem,
repositorySystemSession, createRepositories(repositoryConfigurations),
dependencyResolutionContext);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:25,代碼來源:AetherGrapeEngineFactory.java
示例3: assertSessionCustomization
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private void assertSessionCustomization(String userHome) {
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils
.newSession();
SystemProperties.doWithSystemProperties(new Runnable() {
@Override
public void run() {
new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session,
SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem);
}
}, "user.home:" + userHome);
RemoteRepository repository = new RemoteRepository.Builder("my-server", "default",
"http://maven.example.com").build();
assertMirrorSelectorConfiguration(session, repository);
assertProxySelectorConfiguration(session, repository);
assertAuthenticationSelectorConfiguration(session, repository);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:18,代碼來源:SettingsXmlRepositorySystemSessionAutoConfigurationTests.java
示例4: create
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public RepositorySystem create() throws Throwable{
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
locator.addService( TransporterFactory.class, FileTransporterFactory.class );
locator.addService( TransporterFactory.class, HttpTransporterFactory.class );
final List<Throwable> ecs=new ArrayList<Throwable>();
locator.setErrorHandler( new DefaultServiceLocator.ErrorHandler()
{
@Override
public void serviceCreationFailed( Class<?> type, Class<?> impl, Throwable exception )
{
ecs.add(exception);
}
} );
RepositorySystem repositorySystem=locator.getService( RepositorySystem.class );
if (!ecs.isEmpty()){
throw ecs.get(0);
}
return repositorySystem;
}
示例5: create
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
/**
* Uses the passed Settings in order to configure and create the session
* */
public RepositorySystemSession create(){
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setOffline(settings.getOffline()!=null ? settings.getOffline().booleanValue() : false);
session.setIgnoreArtifactDescriptorRepositories(true);
session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_WARN);
session.setUpdatePolicy(settings.getUpdatePolicy());
LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());
session.setLocalRepositoryManager( repositorySystem.newLocalRepositoryManager( session, localRepo ) );
session.setRepositoryListener( new microsofia.boot.aether.RepositoryListener() );
session.setTransferListener( new microsofia.boot.aether.TransferListener() );
/*TODO should allow the followig to be configured via settings file? (if needed)
* session.setResolutionErrorPolicy();
session.setArtifactDescriptorPolicy(artifactDescriptorPolicy)
session.setSystemProperties(systemProperties)
session.setUserProperties(userProperties)
session.setConfigProperties(configProperties)*/
return session;
}
示例6: newRepositorySystemSession
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, String localRepoPath) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(localRepoPath);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
session.setOffline(this.properties.isOffline());
if (this.properties.getConnectTimeout() != null) {
session.setConfigProperty(ConfigurationProperties.CONNECT_TIMEOUT, this.properties.getConnectTimeout());
}
if (this.properties.getRequestTimeout() != null) {
session.setConfigProperty(ConfigurationProperties.REQUEST_TIMEOUT, this.properties.getRequestTimeout());
}
if (isProxyEnabled()) {
DefaultProxySelector proxySelector = new DefaultProxySelector();
Proxy proxy = new Proxy(this.properties.getProxy().getProtocol(),
this.properties.getProxy().getHost(),
this.properties.getProxy().getPort(),
this.authentication);
proxySelector.add(proxy, this.properties.getProxy().getNonProxyHosts());
session.setProxySelector(proxySelector);
}
return session;
}
示例7: newRepositorySystem
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private RepositorySystem newRepositorySystem() {
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service
* to ease manual wiring and using the prepopulated
* DefaultServiceLocator, we only need to register the repository
* connector and transporter factories.
*/
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(final Class<?> type, final Class<?> impl, final Throwable exception) {
exception.printStackTrace();
}
});
return locator.getService(RepositorySystem.class);
}
示例8: createSession
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private DefaultRepositorySystemSession createSession(Properties properties)
throws NoLocalRepositoryManagerException {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository repository = localRepository(properties);
session.setLocalRepositoryManager(
localRepositoryManagerFactory.newInstance(session, repository));
applySettings(session);
ProxySelector existing = session.getProxySelector();
if (existing == null || !(existing instanceof CompositeProxySelector)) {
JreProxySelector fallback = new JreProxySelector();
ProxySelector selector = existing == null ? fallback
: new CompositeProxySelector(Arrays.asList(existing, fallback));
session.setProxySelector(selector);
}
return session;
}
示例9: AetherResolver
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public AetherResolver() {
localMavenRepo = System.getProperty(LOCAL_REPO_SYS_PROP, DEFAULT_MAVEN_LOCAL);
String remoteString = System.getProperty(REMOTE_REPOS_SYS_PROP, DEFAULT_MAVEN_REMOTES);
// They are space delimited (space is illegal char in urls)
remoteMavenRepos = Arrays.asList(remoteString.split(" "));
httpProxy = System.getProperty(HTTP_PROXY_SYS_PROP);
httpsProxy = System.getProperty(HTTPS_PROXY_SYS_PROP);
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, AetherRepositoryConnectorFactory.class);
locator.addService(LocalRepositoryManagerFactory.class, TakariLocalRepositoryManagerFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler()
{
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
this.repositorySystem = locator.getService(RepositorySystem.class);
}
示例10: assertSessionCustomization
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private void assertSessionCustomization(String userHome) {
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils
.newSession();
SystemProperties.doWithSystemProperties(new Runnable() {
@Override
public void run() {
new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session,
SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem);
}
}, "user.home:" + userHome);
RemoteRepository repository = new RemoteRepository.Builder("my-server", "default",
"http://maven.example.com").build();
assertMirrorSelectorConfiguration(session, repository);
assertProxySelectorConfiguration(session, repository);
assertAuthenticationSelectorConfiguration(session, repository);
}
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:20,代碼來源:SettingsXmlRepositorySystemSessionAutoConfigurationTests.java
示例11: newRepositorySystem
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public static RepositorySystem newRepositorySystem ()
{
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator ();
locator.addService ( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
locator.addService ( TransporterFactory.class, FileTransporterFactory.class );
locator.addService ( TransporterFactory.class, HttpTransporterFactory.class );
locator.setErrorHandler ( new ErrorHandler () {
@Override
public void serviceCreationFailed ( final Class<?> type, final Class<?> impl, final Throwable exception )
{
final Logger logger = LoggerFactory.getLogger ( impl );
logger.warn ( "Service creation failed: " + type.getName (), exception );
}
} );
return locator.getService ( RepositorySystem.class );
}
示例12: newRepositorySystem
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public static RepositorySystem newRepositorySystem ()
{
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator ();
locator.addService ( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
locator.addService ( TransporterFactory.class, FileTransporterFactory.class );
locator.addService ( TransporterFactory.class, HttpTransporterFactory.class );
locator.setErrorHandler ( new DefaultServiceLocator.ErrorHandler () {
@Override
public void serviceCreationFailed ( final Class<?> type, final Class<?> impl, final Throwable exception )
{
exception.printStackTrace ();
}
} );
return locator.getService ( RepositorySystem.class );
}
示例13: newRepositorySystem
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private static RepositorySystem newRepositorySystem()
{
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
//locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
// @Override
// public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception)
// {
// exception.printStackTrace();
// }
//});
return locator.getService(RepositorySystem.class);
}
示例14: newRepositorySystemSession
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
private DefaultRepositorySystemSession newRepositorySystemSession(
RepositorySystem system) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils
.newSession();
// every container must have one
session.setLocalRepositoryManager(system.newLocalRepositoryManager(
session, findLocalRepository()));
// logging for the activity
PrintStream logger = new LoggerStream(LOG, Level.INFO);
session.setTransferListener(new LoggingTransferListener());
session.setRepositoryListener(new LoggingRepositoryListener());
// uncomment to generate dirty trees
// session.setDependencyGraphTransformer( null );
// ignore checksums on smartbear
session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
return session;
}
示例15: newRepositorySystem
import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入依賴的package包/類
public RepositorySystem newRepositorySystem() {
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
* prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter
* factories.
*/
DefaultServiceLocator defaultLocator = MavenRepositorySystemUtils.newServiceLocator();
defaultLocator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
defaultLocator.addService(TransporterFactory.class, FileTransporterFactory.class);
defaultLocator.addService(TransporterFactory.class, HttpTransporterFactory.class);
defaultLocator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
return defaultLocator.getService(RepositorySystem.class);
}