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


Java RemoteRepository类代码示例

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


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

示例1: toRemoteRepository

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

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
@Override
public Artifact resolve(Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session) throws PluginResolutionException {
    WorkspaceReader wr = session.getWorkspaceReader();
    NbWorkspaceReader nbwr = null;
    if (wr instanceof NbWorkspaceReader) {
        nbwr = (NbWorkspaceReader)wr;
        //this only works reliably because the NbWorkspaceReader is part of the session, not a component
        nbwr.silence();
    }
    try {
        return super.resolve(plugin, repositories, session);
    } finally {
        if (nbwr != null) {
            nbwr.normal();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbPluginDependenciesResolver.java

示例3: getMirrorInfo

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
/**
 * if the repository has a mirror, then create a repositoryinfo object for it..
 */

private RepositoryInfo getMirrorInfo(RepositoryInfo info, MirrorSelector selector, Settings settings) {
    RemoteRepository original = new RemoteRepository.Builder(info.getId(), /* XXX do we even support any other layout?*/"default", info.getRepositoryUrl()).build();
    RemoteRepository mirror = selector.getMirror(original);
    if (mirror != null) {
        try {
            String name = mirror.getId();
            //#213078 need to lookup name for mirror
            for (Mirror m : settings.getMirrors()) {
                if (m.getId() != null && m.getId().equals(mirror.getId())) {
                    name = m.getName();
                    break;
                }
            }
            RepositoryInfo toret = new RepositoryInfo(mirror.getId(), name, null, mirror.getUrl());
            toret.setMirrorStrategy(RepositoryInfo.MirrorStrategy.NONE);
            return toret;
        } catch (URISyntaxException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:RepositoryPreferences.java

示例4: getRemoteURLs

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
private List<URL> getRemoteURLs(final List<DependencyNode> nodes) throws IOException {

        final List<URL> urls = new ArrayList<URL>();
        for (DependencyNode node : nodes) {

            final Artifact artifact = node.getArtifact();
            boolean added = false;

            for (RemoteRepository repository : node.getRepositories()) {
                if (!added) {
                    final URL url = constructRemoteURL(artifact, repository);
                    added |= URLUtils.ping(url, URL_PING_TIMEOUT_MILLIS) && urls.add(url);
                }
            }

            if (!added) { throw new IOException("unable to resolve the remote ural of artifact " + artifact); }
        }
        return urls;
    }
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:20,代码来源:MavenDependencyResolver.java

示例5: constructRemoteURL

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
private URL constructRemoteURL(final Artifact artifact, final RemoteRepository repository) throws MalformedURLException {

        final StringBuilder url_as_string = new StringBuilder();
        final String artifact_id = artifact.getArtifactId();
        final String repo_url = repository.getUrl();
        url_as_string.append(repo_url.endsWith("/") ? repo_url : repo_url + "/");
        url_as_string.append(artifact.getGroupId().replaceAll("\\.", "/"));
        url_as_string.append("/");
        url_as_string.append(artifact_id);
        url_as_string.append("/");
        url_as_string.append(artifact.getBaseVersion());
        url_as_string.append("/");
        url_as_string.append(artifact_id);
        url_as_string.append("-");
        url_as_string.append(artifact.getVersion());
        url_as_string.append(".");
        url_as_string.append(artifact.getExtension());

        return new URL(url_as_string.toString());
    }
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:21,代码来源:MavenDependencyResolver.java

示例6: main

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
public static void main(String args[]) throws Exception {

		for (RemoteRepository repo : Utils.getRepositoryList()) {
			System.out.println(repo);
		}

		Artifact artifactObj = new DefaultArtifact("uk.ac.gate.plugins", "annie", "jar", "8.5-SNAPSHOT");
		//artifactObj = artifactObj.setFile(
		//		new File("/home/mark/.m2/repository/uk/ac/gate/plugins/annie/8.5-SNAPSHOT/annie-8.5-SNAPSHOT.jar"));

		SimpleMavenCache reader = new SimpleMavenCache(new File("repo"));
		System.out.println(reader.findArtifact(artifactObj));
		System.out.println(reader.findVersions(artifactObj));
		reader.cacheArtifact(artifactObj);
		System.out.println(reader.findArtifact(artifactObj));
		System.out.println(reader.findVersions(artifactObj));
		
		reader = new SimpleMavenCache(new File("repo2"), new File("repo"));
		System.out.println(reader.findArtifact(artifactObj));
		System.out.println(reader.findVersions(artifactObj));
	}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:22,代码来源:SimpleMavenCache.java

示例7: load

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
public void load(File dataFolder, ConfigurationSection config) {
    Path localRepositoryDirectory = Paths.get(config.getString("local_repository_directory"));
    if (!localRepositoryDirectory.isAbsolute())
        localRepositoryDirectory = dataFolder.toPath().resolve(localRepositoryDirectory);
    setLocalRepositoryDirectory(localRepositoryDirectory.toFile());

    ConfigurationSection repositories = config.getConfigurationSection("repositories");
    if (repositories != null) {
        Map<String, Object> entries = repositories.getValues(false);
        List<RemoteRepository> resultRepositories = new ArrayList<>(entries.size());
        for (Map.Entry<String, Object> entry : entries.entrySet())
            resultRepositories.add(readRemoteRepository(entry.getKey(), (ConfigurationSection) entry.getValue()));
        setRepositories(resultRepositories);
    } else {
        setRepositories(Collections.emptyList());
    }
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:18,代码来源:Config.java

示例8: readRemoteRepository

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
private static RemoteRepository readRemoteRepository(String id, ConfigurationSection config) {
    String url = config.getString("url");
    RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url);

    ConfigurationSection authConfig = config.getConfigurationSection("authentication");
    if (authConfig != null)
        builder = builder.setAuthentication(readAuthentication(authConfig));

    ConfigurationSection releasePolicyConfig = config.getConfigurationSection("release_policy");
    if (releasePolicyConfig != null)
        builder = builder.setReleasePolicy(readRepositoryPolicy(releasePolicyConfig));

    ConfigurationSection snapshotPolicyConfig = config.getConfigurationSection("snapshot_policy");
    if (snapshotPolicyConfig != null)
        builder = builder.setSnapshotPolicy(readRepositoryPolicy(snapshotPolicyConfig));

    return builder.build();
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:19,代码来源:Config.java

示例9: load

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
public void load(File dataFolder, Configuration config) {
    Path localRepositoryDirectory = Paths.get(config.getString("local_repository_directory"));
    if (!localRepositoryDirectory.isAbsolute())
        localRepositoryDirectory = dataFolder.toPath().resolve(localRepositoryDirectory);
    setLocalRepositoryDirectory(localRepositoryDirectory.toFile());

    Configuration repositories = (Configuration) config.get("repositories");
    if (repositories != null) {
        Collection<String> keys = repositories.getKeys();
        List<RemoteRepository> resultRepositories = new ArrayList<>(keys.size());
        for (String key : keys) {
            Configuration value = (Configuration) repositories.get(key);
            resultRepositories.add(readRemoteRepository(key, value));
        }
        setRepositories(resultRepositories);
    } else {
        setRepositories(Collections.emptyList());
    }
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:20,代码来源:Config.java

示例10: readRemoteRepository

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
private static RemoteRepository readRemoteRepository(String id, Configuration config) {
    String url = config.getString("url");
    RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url);

    Configuration authConfig = (Configuration) config.get("authentication");
    if (authConfig != null)
        builder = builder.setAuthentication(readAuthentication(authConfig));

    Configuration releasePolicyConfig = (Configuration) config.get("release_policy");
    if (releasePolicyConfig != null)
        builder = builder.setReleasePolicy(readRepositoryPolicy(releasePolicyConfig));

    Configuration snapshotPolicyConfig = (Configuration) config.get("snapshot_policy");
    if (snapshotPolicyConfig != null)
        builder = builder.setSnapshotPolicy(readRepositoryPolicy(snapshotPolicyConfig));

    return builder.build();
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:19,代码来源:Config.java

示例11: getLatestVersion

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
private String getLatestVersion(String groupId, String artifactId, String range,
        RepositorySystemSession session, List<RemoteRepository> remotes)
        throws VersionRangeResolutionException {
    VersionRangeRequest rangeRequest = new VersionRangeRequest();
    rangeRequest.setArtifact(
            new DefaultArtifact(String.format("%s:%s:%s", groupId, artifactId, range)));
    rangeRequest.setRepositories(remotes);

    VersionRangeResult rangeResult = repoSystem.resolveVersionRange(session, rangeRequest);
    if (rangeResult.getHighestVersion() != null) {
        return rangeResult.getHighestVersion().toString();
    }
    else {
        throw new com.atomist.rug.resolver.maven.DependencyCollectionException(String
                .format("Unable to find a version of archive %s:%s.", groupId, artifactId),
                properties.repositories());
    }
}
 
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:19,代码来源:MavenBasedDependencyResolver.java

示例12: resolvePluginDependency

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
/**
 * Uses the aether to resolve a plugin dependency and returns the file for further processing.
 *
 * @param d the dependency to resolve.
 * @param pluginRepos the plugin repositories to use for dependency resolution.
 * @param resolver the resolver for aether access.
 * @param repoSystemSession the session for the resolver.
 * @return optionally a file which is the resolved dependency.
 */
public static Optional<File> resolvePluginDependency(Dependency d, List<RemoteRepository> pluginRepos,
    ArtifactResolver resolver, RepositorySystemSession repoSystemSession) {
  Artifact a = new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), d.getType(), d.getVersion());
  ArtifactRequest artifactRequest = new ArtifactRequest();
  artifactRequest.setArtifact(a);
  artifactRequest.setRepositories(pluginRepos);
  try {
    ArtifactResult artifactResult = resolver.resolveArtifact(repoSystemSession, artifactRequest);
    if (artifactResult.getArtifact() != null) {
      return Optional.fromNullable(artifactResult.getArtifact().getFile());
    }
    return Optional.absent();
  } catch (ArtifactResolutionException e) {
    return Optional.absent();
  }
}
 
开发者ID:shillner,项目名称:maven-cdi-plugin-utils,代码行数:26,代码来源:MavenUtil.java

示例13: createRepositories

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

示例14: AetherGrapeEngine

import org.eclipse.aether.repository.RemoteRepository; //导入依赖的package包/类
public AetherGrapeEngine(GroovyClassLoader classLoader,
		RepositorySystem repositorySystem,
		DefaultRepositorySystemSession repositorySystemSession,
		List<RemoteRepository> remoteRepositories,
		DependencyResolutionContext resolutionContext) {
	this.classLoader = classLoader;
	this.repositorySystem = repositorySystem;
	this.session = repositorySystemSession;
	this.resolutionContext = resolutionContext;
	this.repositories = new ArrayList<RemoteRepository>();
	List<RemoteRepository> remotes = new ArrayList<RemoteRepository>(
			remoteRepositories);
	Collections.reverse(remotes); // priority is reversed in addRepository
	for (RemoteRepository repository : remotes) {
		addRepository(repository);
	}
	this.progressReporter = getProgressReporter(this.session);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:AetherGrapeEngine.java

示例15: assertSessionCustomization

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


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