Search in sources :

Example 41 with Artifact

use of org.eclipse.aether.artifact.Artifact in project drools by kiegroup.

the class KieRepositoryScannerImpl method indexArtifacts.

private Map<ReleaseId, DependencyDescriptor> indexArtifacts() {
    Map<ReleaseId, DependencyDescriptor> depsMap = new HashMap<ReleaseId, DependencyDescriptor>();
    for (DependencyDescriptor dep : artifactResolver.getAllDependecies()) {
        if (!"test".equals(dep.getScope()) && !"provided".equals(dep.getScope()) && !"system".equals(dep.getScope())) {
            Artifact artifact = artifactResolver.resolveArtifact(dep.getReleaseId());
            log.debug(artifact + " resolved to  " + artifact.getFile());
            if (isKJar(artifact.getFile())) {
                depsMap.put(adapt(dep.getReleaseIdWithoutVersion()), new DependencyDescriptor(artifact));
            }
        } else {
            log.debug("{} does not need to be resolved because in scope {}", dep, dep.getScope());
        }
    }
    return depsMap;
}
Also used : DependencyDescriptor(org.appformer.maven.integration.DependencyDescriptor) HashMap(java.util.HashMap) ReleaseId(org.kie.api.builder.ReleaseId) Artifact(org.eclipse.aether.artifact.Artifact)

Aggregations

Artifact (org.eclipse.aether.artifact.Artifact)41 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)30 File (java.io.File)11 Dependency (org.eclipse.aether.graph.Dependency)9 SubArtifact (org.eclipse.aether.util.artifact.SubArtifact)9 IOException (java.io.IOException)8 ArtifactResolutionException (org.eclipse.aether.resolution.ArtifactResolutionException)8 ArrayList (java.util.ArrayList)7 ArtifactResult (org.eclipse.aether.resolution.ArtifactResult)7 DependencyRequest (org.eclipse.aether.resolution.DependencyRequest)7 Path (java.nio.file.Path)6 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)6 CollectRequest (org.eclipse.aether.collection.CollectRequest)6 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)5 STGroupString (org.stringtemplate.v4.STGroupString)5 Jar (aQute.bnd.osgi.Jar)4 URISyntaxException (java.net.URISyntaxException)4 URL (java.net.URL)4 List (java.util.List)4 ArtifactRequest (org.eclipse.aether.resolution.ArtifactRequest)4