Search in sources :

Example 1 with AFReleaseId

use of org.appformer.maven.support.AFReleaseId in project drools by kiegroup.

the class KieBuilderImpl method init.

private PomModel init() {
    KieServices ks = KieServices.Factory.get();
    results = new ResultsImpl();
    // if pomXML is null it will generate a default, using default ReleaseId
    // if pomXml is invalid, it assign pomModel to null
    PomModel pomModel = getPomModel();
    // if kModuleModelXML is null or invalid it will generate a default kModule, with a default kbase name
    buildKieModuleModel();
    if (pomModel != null) {
        // creates ReleaseId from build pom
        // If the pom was generated, it will be the same as teh default ReleaseId
        releaseId = pomModel.getReleaseId();
        // add all the pom dependencies to this builder ... not sure this is a good idea (?)
        KieRepositoryImpl repository = (KieRepositoryImpl) ks.getRepository();
        for (AFReleaseId dep : pomModel.getDependencies(DependencyFilter.COMPILE_FILTER)) {
            KieModule depModule = repository.getKieModule(adapt(dep), pomModel);
            if (depModule != null) {
                addKieDependency(depModule);
            }
        }
    } else {
        // if the pomModel is null it means that the provided pom.xml is invalid so use the default releaseId
        releaseId = KieServices.Factory.get().getRepository().getDefaultReleaseId();
    }
    return pomModel;
}
Also used : AFReleaseId(org.appformer.maven.support.AFReleaseId) PomModel(org.appformer.maven.support.PomModel) KieServices(org.kie.api.KieServices) KieModule(org.kie.api.builder.KieModule)

Example 2 with AFReleaseId

use of org.appformer.maven.support.AFReleaseId in project drools by kiegroup.

the class KieModuleMetaDataImpl method init.

private void init(ArtifactResolver artifactResolver) {
    if (artifactResolver == null) {
        return;
    }
    if (releaseId != null) {
        addArtifact(artifactResolver.resolveArtifact(releaseId));
    }
    if (kieModule != null && kieModule.getPomModel() != null) {
        for (AFReleaseId releaseId : kieModule.getPomModel().getDependencies(dependencyFilter)) {
            addArtifact(artifactResolver.resolveArtifact(releaseId));
        }
    } else {
        for (DependencyDescriptor dep : artifactResolver.getAllDependecies(dependencyFilter)) {
            addArtifact(artifactResolver.resolveArtifact(dep.getReleaseId()));
        }
    }
    packages.addAll(classes.keySet());
    packages.addAll(rulesByPackage.keySet());
}
Also used : AFReleaseId(org.appformer.maven.support.AFReleaseId) DependencyDescriptor(org.appformer.maven.integration.DependencyDescriptor)

Aggregations

AFReleaseId (org.appformer.maven.support.AFReleaseId)2 DependencyDescriptor (org.appformer.maven.integration.DependencyDescriptor)1 PomModel (org.appformer.maven.support.PomModel)1 KieServices (org.kie.api.KieServices)1 KieModule (org.kie.api.builder.KieModule)1