当前位置: 首页>>代码示例>>Java>>正文


Java DefaultRepositorySystemSession.setOffline方法代码示例

本文整理汇总了Java中org.eclipse.aether.DefaultRepositorySystemSession.setOffline方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultRepositorySystemSession.setOffline方法的具体用法?Java DefaultRepositorySystemSession.setOffline怎么用?Java DefaultRepositorySystemSession.setOffline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.aether.DefaultRepositorySystemSession的用法示例。


在下文中一共展示了DefaultRepositorySystemSession.setOffline方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的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;
   }
 
开发者ID:microsofia,项目名称:microsofia-boot,代码行数:28,代码来源:RepositorySystemSessionBuilder.java

示例2: newRepositorySystemSession

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer,代码行数:23,代码来源:MavenArtifactResolver.java

示例3: applySettings

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
public static void applySettings(MavenSettings settings,
		DefaultRepositorySystemSession session) {
	if (settings.getLocalRepository() != null) {
		try {
			session.setLocalRepositoryManager(
					new SimpleLocalRepositoryManagerFactory().newInstance(session,
							new LocalRepository(settings.getLocalRepository())));
		}
		catch (NoLocalRepositoryManagerException e) {
			throw new IllegalStateException(
					"Cannot set local repository to " + settings.getLocalRepository(),
					e);
		}
	}
	session.setOffline(settings.getOffline());
	session.setMirrorSelector(settings.getMirrorSelector());
	session.setAuthenticationSelector(settings.getAuthenticationSelector());
	session.setProxySelector(settings.getProxySelector());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:20,代码来源:MavenSettingsReader.java

示例4: getSettings

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
private MavenSettings getSettings(DefaultRepositorySystemSession session) {
	MavenSettings settings = new MavenSettingsReader().readSettings();
	session.setOffline(settings.getOffline());
	session.setMirrorSelector(settings.getMirrorSelector());
	session.setAuthenticationSelector(settings.getAuthenticationSelector());
	session.setProxySelector(settings.getProxySelector());
	return settings;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:SettingsXmlRepositorySystemSessionAutoConfiguration.java

示例5: newRepositorySystemSession

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
private DefaultRepositorySystemSession newRepositorySystemSession() {
	final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
	final LocalRepository localRepo = new LocalRepository("maven-repo");
	session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
	session.setOffline(true);
	return session;
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:8,代码来源:NestedModulesBaseTest.java

示例6: setupRepoSession

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings)
{
   DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
   session.setOffline(false);

   Proxy activeProxy = settings.getActiveProxy();
   if (activeProxy != null)
   {
      DefaultProxySelector dps = new DefaultProxySelector();
      dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
      session.setProxySelector(dps);
   }

   final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings);
   final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);

   session.setMirrorSelector(mirrorSelector);
   session.setAuthenticationSelector(authSelector);

   LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()));
   session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
   session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
   session.setCache(new DefaultRepositoryCache());
   boolean cacheNotFoundArtifacts = true;
   boolean cacheTransferErrors = true;
   session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors));
   session.setWorkspaceReader(new ClasspathWorkspaceReader());
   if (Boolean.getBoolean("org.apache.maven.log_transfer"))
   {
      session.setTransferListener(new JULMavenTransferListener());
   }
   return session;
}
 
开发者ID:forge,项目名称:furnace,代码行数:34,代码来源:MavenContainer.java

示例7: setupRepoSession

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings)
{
   DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
   session.setOffline(false);

   Proxy activeProxy = settings.getActiveProxy();
   if (activeProxy != null)
   {
      DefaultProxySelector dps = new DefaultProxySelector();
      dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
      session.setProxySelector(dps);
   }

   final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings);
   final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);

   session.setMirrorSelector(mirrorSelector);
   session.setAuthenticationSelector(authSelector);

   LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()));
   session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
   session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
   session.setCache(new DefaultRepositoryCache());
   boolean cacheNotFoundArtifacts = true;
   boolean cacheTransferErrors = true;
   session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors));
   session.setWorkspaceReader(new ClasspathWorkspaceReader());
   session.setTransferListener(new LogTransferListener(System.out));
   return session;
}
 
开发者ID:koentsje,项目名称:forge-furnace,代码行数:31,代码来源:MavenContainer.java

示例8: runWithStringInput

import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
static String runWithStringInput(Config config, String input) throws Exception {
    Configuration configuration = new Configuration(config.getConfig("xyz.cloudkeeper.samples"));
    AetherConfiguration aetherConfiguration = configuration.aetherConfiguration;
    DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
    locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
    locator.addService(TransporterFactory.class, FileTransporterFactory.class);
    locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
    RepositorySystem repositorySystem = locator.getService(RepositorySystem.class);
    LocalRepository localRepository = new LocalRepository(aetherConfiguration.localRepositoryPath.toFile());
    DefaultRepositorySystemSession repositorySystemSession = MavenRepositorySystemUtils.newSession();
    repositorySystemSession.setLocalRepositoryManager(
        repositorySystem.newLocalRepositoryManager(repositorySystemSession, localRepository)
    );
    // For this example, let's always check for new versions of the Maven artifacts
    repositorySystemSession.setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_ALWAYS);
    repositorySystemSession.setOffline(aetherConfiguration.offline);

    ActorSystem actorSystem = ActorSystem.create("CloudKeeper-Runner");
    Executor executor = actorSystem.dispatcher();

    MavenRuntimeContextFactory runtimeContextFactory = new MavenRuntimeContextFactory.Builder(
            executor, repositorySystem, repositorySystemSession)
        .setRemoteRepositories(aetherConfiguration.remoteRepositories)
        .setExecutableProviderProvider(classLoader -> new DSLExecutableProvider(new ModuleFactory(classLoader)))
        .build();
    InstanceProvider instanceProvider = new SimpleInstanceProvider.Builder(executor)
        .setRuntimeContextFactory(runtimeContextFactory)
        .build();
    SingleVMCloudKeeper cloudKeeper = new SingleVMCloudKeeper.Builder()
        .setInstanceProvider(instanceProvider)
        .build();
    CloudKeeperEnvironment cloudKeeperEnvironment = cloudKeeper.newCloudKeeperEnvironmentBuilder().build();

    MutableModule<?> module = new MutableProxyModule()
        .setDeclaration(new MutableQualifiedNamable().setQualifiedName(configuration.module));

    WorkflowExecution workflowExecution = cloudKeeperEnvironment.newWorkflowExecutionBuilder(module)
        .setInputs(Collections.singletonMap(configuration.inPort, input))
        .setBundleIdentifiers(Collections.singletonList(configuration.dependency))
        .start();
    String output = (String) workflowExecution
        .getOutput(configuration.outPort.toString())
        .get(configuration.timeoutSeconds, TimeUnit.SECONDS);

    cloudKeeper.shutdown().awaitTermination();
    Await.result(actorSystem.terminate(), Duration.Inf());

    return output;
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:50,代码来源:ModuleRunner.java


注:本文中的org.eclipse.aether.DefaultRepositorySystemSession.setOffline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。