Search in sources :

Example 6 with MavenRepositoryLocation

use of org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation in project tycho by eclipse.

the class TargetPlatformFactoryImpl method gatherExternalInstallableUnits.

/**
 * External installable units collected from p2 repositories, .target files and local Maven
 * repository.
 */
private LinkedHashSet<IInstallableUnit> gatherExternalInstallableUnits(Set<MavenRepositoryLocation> completeRepositories, List<TargetDefinitionContent> targetDefinitionsContent, PomDependencyCollectorImpl pomDependenciesContent, boolean includeLocalMavenRepo) {
    LinkedHashSet<IInstallableUnit> result = new LinkedHashSet<>();
    for (TargetDefinitionContent targetDefinitionContent : targetDefinitionsContent) {
        result.addAll(targetDefinitionContent.getUnits());
    }
    List<IMetadataRepository> metadataRepositories = new ArrayList<>();
    for (MavenRepositoryLocation location : completeRepositories) {
        metadataRepositories.add(loadMetadataRepository(location));
    }
    if (includeLocalMavenRepo) {
        metadataRepositories.add(localMetadataRepository);
    }
    for (IMetadataRepository repository : metadataRepositories) {
        IQueryResult<IInstallableUnit> matches = repository.query(QueryUtil.ALL_UNITS, monitor);
        result.addAll(matches.toUnmodifiableSet());
    }
    result.addAll(pomDependenciesContent.gatherMavenInstallableUnits());
    if (includeLocalMavenRepo && logger.isDebugEnabled()) {
        IQueryResult<IInstallableUnit> locallyInstalledIUs = localMetadataRepository.query(QueryUtil.ALL_UNITS, null);
        logger.debug("Added " + countElements(locallyInstalledIUs.iterator()) + " locally built units to the target platform");
    }
    return result;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) MavenRepositoryLocation(org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation) ArrayList(java.util.ArrayList) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)

Example 7 with MavenRepositoryLocation

use of org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation in project tycho by eclipse.

the class RemoteRepositoryLoadingHelper method getEffectiveLocationAndPrepareLoad.

public URI getEffectiveLocationAndPrepareLoad(URI location) throws ProvisionException {
    if (certainlyNoRemoteURL(location)) {
        return location;
    }
    MavenRepositoryLocation effectiveLocation = effectiveLocationFor(location, true);
    setPasswordForLoading(effectiveLocation);
    return effectiveLocation.getURL();
}
Also used : MavenRepositoryLocation(org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)

Example 8 with MavenRepositoryLocation

use of org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation in project tycho by eclipse.

the class RemoteRepositoryLoadingHelper method effectiveLocationFor.

private MavenRepositoryLocation effectiveLocationFor(URI location, boolean forLoading) {
    URI normalizedLocation = normalize(location);
    String id = knownMavenRepositoryIds.get(normalizedLocation);
    if (id == null) {
        // fall back to URL as ID
        id = normalizedLocation.toString();
    }
    MavenRepositoryLocation locationWithID = new MavenRepositoryLocation(id, normalizedLocation);
    MavenRepositoryLocation mirror = settings.getMirror(locationWithID);
    if (mirror != null) {
        if (forLoading) {
            logger.info("Loading repository '" + id + "' from mirror '" + mirror.getId() + "' at '" + mirror.getURL() + "'");
        }
        return mirror;
    } else {
        return locationWithID;
    }
}
Also used : MavenRepositoryLocation(org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation) URI(java.net.URI)

Aggregations

MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)8 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)4 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 File (java.io.File)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)2 IP2Artifact (org.eclipse.tycho.p2.metadata.IP2Artifact)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 LinkedHashSet (java.util.LinkedHashSet)1 Artifact (org.apache.maven.artifact.Artifact)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 IStatus (org.eclipse.core.runtime.IStatus)1