當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。