Search in sources :

Example 1 with ApplicationModel

use of io.quarkus.bootstrap.model.ApplicationModel in project camel-quarkus by apache.

the class XchangeProcessor method indexDependenciesAndResources.

@BuildStep
void indexDependenciesAndResources(BuildProducer<IndexDependencyBuildItem> indexedDependency, BuildProducer<NativeImageResourceBuildItem> nativeImageResource, CurateOutcomeBuildItem curateOutcome) {
    ApplicationModel applicationModel = curateOutcome.getApplicationModel();
    for (ResolvedDependency dependency : applicationModel.getDependencies()) {
        if (dependency.getGroupId().equals("org.knowm.xchange")) {
            // Index any org.knowm.xchange dependencies present on the classpath as they contain the APIs for interacting with each crypto exchange
            String artifactId = dependency.getArtifactId();
            indexedDependency.produce(new IndexDependencyBuildItem(dependency.getGroupId(), artifactId));
            // Include crypto exchange metadata resources
            String[] split = artifactId.split("-");
            if (split.length > 1) {
                String cryptoExchange = split[split.length - 1];
                nativeImageResource.produce(new NativeImageResourceBuildItem(cryptoExchange + ".json"));
            }
        }
    }
    indexedDependency.produce(new IndexDependencyBuildItem("org.jboss.spec.javax.ws.rs", "jboss-jaxrs-api_2.1_spec"));
}
Also used : NativeImageResourceBuildItem(io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem) IndexDependencyBuildItem(io.quarkus.deployment.builditem.IndexDependencyBuildItem) ResolvedDependency(io.quarkus.maven.dependency.ResolvedDependency) ApplicationModel(io.quarkus.bootstrap.model.ApplicationModel) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

ApplicationModel (io.quarkus.bootstrap.model.ApplicationModel)1 BuildStep (io.quarkus.deployment.annotations.BuildStep)1 IndexDependencyBuildItem (io.quarkus.deployment.builditem.IndexDependencyBuildItem)1 NativeImageResourceBuildItem (io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem)1 ResolvedDependency (io.quarkus.maven.dependency.ResolvedDependency)1