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


Java RepositoryPolicy类代码示例

本文整理汇总了Java中org.eclipse.aether.repository.RepositoryPolicy的典型用法代码示例。如果您正苦于以下问题:Java RepositoryPolicy类的具体用法?Java RepositoryPolicy怎么用?Java RepositoryPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: toRemoteRepository

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
public static RemoteRepository toRemoteRepository(
    String repoUrl, Optional<String> username, Optional<String> password) {
  RemoteRepository.Builder repo =
      new RemoteRepository.Builder(null, "default", repoUrl)
          .setPolicy(new RepositoryPolicy(true, null, CHECKSUM_POLICY_FAIL));

  if (username.isPresent() && password.isPresent()) {
    Authentication authentication =
        new AuthenticationBuilder()
            .addUsername(username.get())
            .addPassword(password.get())
            .build();
    repo.setAuthentication(authentication);
  }

  return repo.build();
}
 
开发者ID:facebook,项目名称:buck,代码行数:18,代码来源:AetherUtil.java

示例2: createRepositories

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private static List<RemoteRepository> createRepositories(
		List<RepositoryConfiguration> repositoryConfigurations) {
	List<RemoteRepository> repositories = new ArrayList<RemoteRepository>(
			repositoryConfigurations.size());
	for (RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) {
		RemoteRepository.Builder builder = new RemoteRepository.Builder(
				repositoryConfiguration.getName(), "default",
				repositoryConfiguration.getUri().toASCIIString());

		if (!repositoryConfiguration.getSnapshotsEnabled()) {
			builder.setSnapshotPolicy(
					new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER,
							RepositoryPolicy.CHECKSUM_POLICY_IGNORE));
		}
		repositories.add(builder.build());
	}
	return repositories;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:AetherGrapeEngineFactory.java

示例3: create

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的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

示例4: maven

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
/** CAUTION: this is not a session method, because it respected the stage repository */
public Maven maven() throws IOException {
    World world;
    String mavenHome;
    FileNode settings;

    if (lazyMaven == null) {
        world = session.world;
        mavenHome = config().mavenHome();
        if (mavenHome == null) {
            settings = session.home.join("maven-settings.xml");
        } else {
            settings = world.file(mavenHome).join("conf/settings.xml");
        }
        // CAUTION: shared plexus - otherwise, Maven components are created over and over again
        lazyMaven = Maven.withSettings(world, localRepository(), settings, null, session.plexus(), null, null);
        // always get the latest snapshots
        lazyMaven.getRepositorySession().setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_ALWAYS);
    }
    return lazyMaven;
}
 
开发者ID:mlhartme,项目名称:stool,代码行数:22,代码来源:Stage.java

示例5: newRepositorySystemSession

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的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;
}
 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:24,代码来源:AetherClasspathResolver.java

示例6: getRemoteRepoFromDeployment

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository repo,
                                                     final MavenEmbedder embedder) {
    RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(repo.getId(),
                                                                              repo.getLayout(),
                                                                              repo
                                                                                      .getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    Settings settings = MavenSettings.getSettings();
    Server server = settings.getServer(repo.getId());

    if (server != null) {
        Authentication authentication = embedder.getMavenSession().getRepositorySession()
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:DistributionManagementArtifactRepository.java

示例7: createRepository

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private RemoteRepository createRepository(final String dir) {
    File m2RepoDir = new File(dir);
    if (!m2RepoDir.exists()) {
        logger.error("Repository root does not exist: " + dir);
        throw new IllegalArgumentException("Repository root does not exist: " + dir);
    }

    try {
        String localRepositoryUrl = m2RepoDir.toURI().toURL().toExternalForm();
        return new RemoteRepository.Builder(this.getName(),
                                            "default",
                                            localRepositoryUrl)
                .setSnapshotPolicy(new RepositoryPolicy(true,
                                                        RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                        RepositoryPolicy.CHECKSUM_POLICY_WARN))
                .setReleasePolicy(new RepositoryPolicy(true,
                                                       RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                       RepositoryPolicy.CHECKSUM_POLICY_WARN))
                .build();
    } catch (MalformedURLException e) {
        logger.error(e.getMessage(),
                     e);
        throw new RuntimeException(e);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:FileSystemArtifactRepository.java

示例8: convertToArtifactRepository

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private RemoteRepository convertToArtifactRepository(final org.apache.maven.artifact.repository.ArtifactRepository artifactRepository) {
    final MavenEmbedder mavenEmbedder = MavenProjectLoader.newMavenEmbedder(MavenSettings.getSettings().isOffline());
    final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(artifactRepository.getId(),
                                                                                    artifactRepository.getLayout().getId(),
                                                                                    artifactRepository.getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    final Settings settings = MavenSettings.getSettings();
    final Server server = settings.getServer(artifactRepository.getId());

    if (server != null) {
        final Authentication authentication = mavenEmbedder
                .getMavenSession()
                .getRepositorySession()
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:ProjectRepositoryResolverImpl.java

示例9: getRemoteRepoFromDeployment

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private static RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository deploymentRepository,
                                                            final RepositorySystemSession mavenSession) {
    final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(deploymentRepository.getId(),
                                                                                    deploymentRepository.getLayout(),
                                                                                    deploymentRepository.getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    final Settings settings = MavenSettings.getSettings();
    final Server server = settings.getServer(deploymentRepository.getId());

    if (server != null) {
        final Authentication authentication = mavenSession
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:RepositoryResolverTestUtils.java

示例10: toRepositoryPolicy

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
public static RepositoryPolicy toRepositoryPolicy(org.apache.maven.model.RepositoryPolicy policy) {
  boolean enabled = true;
  String checksums = RepositoryPolicy.CHECKSUM_POLICY_WARN;
  String updates = RepositoryPolicy.UPDATE_POLICY_DAILY;

  if (policy != null) {
    enabled = policy.isEnabled();
    if (policy.getUpdatePolicy() != null) {
      updates = policy.getUpdatePolicy();
    }
    if (policy.getChecksumPolicy() != null) {
      checksums = policy.getChecksumPolicy();
    }
  }

  return new RepositoryPolicy(enabled, updates, checksums);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:18,代码来源:AetherUtils.java

示例11: repositories

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
public List<RemoteRepository> repositories()
{
    if (repoUrl != null && repoUrl.length() > 0) {
        RepositoryPolicy policy = new RepositoryPolicy(true,
                                                       UPDATE_POLICY_ALWAYS,
                                                       CHECKSUM_POLICY_WARN);
        RemoteRepository repository =
                new RemoteRepository.Builder("temp", "default", repoUrl)
                        .setSnapshotPolicy(policy).build();
        return Arrays.asList(CENTRAL, repository);
    }

    return Collections.singletonList(CENTRAL);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:AetherResolver.java

示例12: buildRemoteRepository

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private RemoteRepository buildRemoteRepository(final String id, final String url, final Authentication auth,
                                               final ArtifactRepositoryPolicy releasesPolicy, final ArtifactRepositoryPolicy snapshotsPolicy) {
    RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url);
    if (auth != null
            && auth.getUsername() != null
            && auth.getPassword() != null) {
        builder.setAuthentication(new AuthenticationBuilder()
                                          .addUsername(auth.getUsername())
                                          .addPassword(auth.getPassword()).build());
    }

    builder.setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy()));
    builder.setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy()));

    RemoteRepository repository = builder.build();

    final RemoteRepository mirror = session.getMirrorSelector().getMirror(repository);

    if (mirror != null) {
        final org.eclipse.aether.repository.Authentication mirrorAuth = session.getAuthenticationSelector()
                .getAuthentication(mirror);
        RemoteRepository.Builder mirrorBuilder = new RemoteRepository.Builder(mirror)
                .setId(repository.getId())
                .setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy()))
                .setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy()));
        if (mirrorAuth != null) {
            mirrorBuilder.setAuthentication(mirrorAuth);
        }
        repository = mirrorBuilder.build();
    }

    Proxy proxy = session.getProxySelector().getProxy(repository);

    if (proxy != null) {
        repository = new RemoteRepository.Builder(repository).setProxy(proxy).build();
    }

    return repository;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:40,代码来源:MavenArtifactResolvingHelper.java

示例13: propagateRepositoryPolicies

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
@Test
// SWARM-1173: swarm-plugin trying to download SNAPSHOTs from Maven Central
public void propagateRepositoryPolicies() {
    RepositorySystemSession sessionMock = Mockito.mock(RepositorySystemSession.class);
    MirrorSelector mirrorSelectorMock = Mockito.mock(MirrorSelector.class);
    Mockito.when(sessionMock.getMirrorSelector()).thenReturn(mirrorSelectorMock);
    ProxySelector proxySelectorMock = Mockito.mock(ProxySelector.class);
    Mockito.when(sessionMock.getProxySelector()).thenReturn(proxySelectorMock);

    MavenArtifactResolvingHelper artifactResolverHelper = new MavenArtifactResolvingHelper(null, null, sessionMock, null);
    ArtifactRepositoryPolicy testSnapshotPolicy = new ArtifactRepositoryPolicy(false, "hourly", "warn");
    ArtifactRepositoryPolicy testReleasesPolicy = new ArtifactRepositoryPolicy(true, "never", "warn");
    ArtifactRepository testingRepo = new MavenArtifactRepository("testing-repo", "http://testing-repo.org", new DefaultRepositoryLayout(), testSnapshotPolicy, testReleasesPolicy);
    artifactResolverHelper.remoteRepository(testingRepo);

    List<RemoteRepository> remoteRepos = artifactResolverHelper.getRemoteRepositories();

    Assert.assertTrue("Remote repositories " + remoteRepos + " do not contain expected testing repo " + testingRepo,
                      remoteRepos.stream().anyMatch(
                              remoteRepo -> {
                                  RepositoryPolicy snapshotsPolicy = remoteRepo.getPolicy(true);
                                  RepositoryPolicy releasesPolicy = remoteRepo.getPolicy(false);
                                  return remoteRepo.getId().equals(testingRepo.getId()) &&
                                          !snapshotsPolicy.isEnabled() &&
                                          snapshotsPolicy.getUpdatePolicy().equals(testSnapshotPolicy.getUpdatePolicy()) &&
                                          snapshotsPolicy.getChecksumPolicy().equals(testSnapshotPolicy.getChecksumPolicy()) &&
                                          releasesPolicy.isEnabled() &&
                                          releasesPolicy.getUpdatePolicy().equals(testReleasesPolicy.getUpdatePolicy()) &&
                                          releasesPolicy.getChecksumPolicy().equals(testReleasesPolicy.getChecksumPolicy());
                              })
    );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:33,代码来源:MavenArtifactResolvingHelperTest.java

示例14: selectRepositoryToDeploy

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private RemoteRepository selectRepositoryToDeploy(Artifact artifactToDeploy) {
	if (artifactToDeploy == null) {
		throw new IllegalArgumentException("artifactToDeploy should not be null");
	}

	RemoteRepository.Builder snapRepoBuilder =  new RemoteRepository.Builder("paas.push.snapshot.repo", "default", mvnConsumerConfigurer.getPushSnapshotRepositoryUrl());
	RepositoryPolicy disabledRepo = null;
	snapRepoBuilder.setReleasePolicy(disabledRepo);
	Authentication snapshotRepositoryAuthen = new AuthenticationBuilder().addUsername(mvnConsumerConfigurer.getPushSnapshotRepositoryUser()).addPassword(
			mvnConsumerConfigurer.getPushSnapshotRepositoryPassword()).build();
	snapRepoBuilder.setAuthentication(snapshotRepositoryAuthen);

	RemoteRepository.Builder releaseRepoBuilder = new RemoteRepository.Builder("paas.push.release.repo", "default", mvnConsumerConfigurer.getPushReleaseRepositoryUrl());
	releaseRepoBuilder.setReleasePolicy(disabledRepo);
	Authentication releaseRepositoryAuthen = new AuthenticationBuilder().addUsername(mvnConsumerConfigurer.getPushReleaseRepositoryUser()).addPassword(
			mvnConsumerConfigurer.getPushReleaseRepositoryPassword()).build();
	releaseRepoBuilder.setAuthentication(releaseRepositoryAuthen);

	RemoteRepository result;
	if (artifactToDeploy.isSnapshot()) {
		result = snapRepoBuilder.build();
	} else {
		result = releaseRepoBuilder.build();
	}

	return result;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:28,代码来源:MavenDeployer.java

示例15: initPullRepoInterval

import org.eclipse.aether.repository.RepositoryPolicy; //导入依赖的package包/类
private void initPullRepoInterval() {
	int repoCount=1;
	for (String aPullRepoUrl: pullRepositoryUrls) {
		RemoteRepository.Builder builder = new RemoteRepository.Builder("remoteRepo-" + repoCount++, "default", aPullRepoUrl);
		RepositoryPolicy releasePolicy = getRepositoryPolicy(releaseRepositoryRefreshIntervalInMin);
		builder.setReleasePolicy(releasePolicy);

		RepositoryPolicy snapshotPolicy = getRepositoryPolicy(snapshotRepositoryRefreshIntervalInMin);
		builder.setSnapshotPolicy(snapshotPolicy);
		this.pullRemoteRepo.add(builder.build());
	}
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:13,代码来源:MvnConsumerConfigurer.java


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