Search in sources :

Example 6 with DependencyDescriptor

use of org.appformer.maven.integration.DependencyDescriptor in project drools by kiegroup.

the class KieRepositoryScannerImpl method setKieContainer.

public synchronized void setKieContainer(KieContainer kieContainer) {
    if (this.kieContainer != null) {
        throw new RuntimeException("Cannot change KieContainer on an already initialized KieScanner");
    }
    this.kieContainer = (InternalKieContainer) kieContainer;
    if (this.kieContainer.getContainerReleaseId() == null) {
        throw new RuntimeException("The KieContainer's ReleaseId cannot be null. Are you using a KieClasspathContainer?");
    }
    artifactResolver = getResolverFor(this.kieContainer, true);
    kieProjectDescr = new DependencyDescriptor(this.kieContainer.getReleaseId(), this.kieContainer.getCreationTimestamp());
    usedDependencies = indexArtifacts();
    KieScannersRegistry.register(this);
    changeStatus(Status.STOPPED);
    if (MBeanUtils.isMBeanEnabled()) {
        mbean = new KieScannerMBeanImpl(this);
    }
}
Also used : DependencyDescriptor(org.appformer.maven.integration.DependencyDescriptor) KieScannerMBeanImpl(org.kie.scanner.management.KieScannerMBeanImpl)

Example 7 with DependencyDescriptor

use of org.appformer.maven.integration.DependencyDescriptor 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

DependencyDescriptor (org.appformer.maven.integration.DependencyDescriptor)7 ReleaseId (org.kie.api.builder.ReleaseId)4 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)3 Artifact (org.eclipse.aether.artifact.Artifact)3 HashMap (java.util.HashMap)2 AFReleaseId (org.appformer.maven.support.AFReleaseId)1 ResultsImpl (org.drools.compiler.kie.builder.impl.ResultsImpl)1 ReleaseIdImpl (org.drools.compiler.kproject.ReleaseIdImpl)1 Results (org.kie.api.builder.Results)1 KieScannerMBeanImpl (org.kie.scanner.management.KieScannerMBeanImpl)1