diff --git a/pkg/builder/runtime/quarkus.go b/pkg/builder/runtime/quarkus.go index e7dea568df..5e94ba4515 100644 --- a/pkg/builder/runtime/quarkus.go +++ b/pkg/builder/runtime/quarkus.go @@ -59,11 +59,21 @@ func loadCamelQuarkusCatalog(ctx *builder.Context) error { func generateQuarkusProject(ctx *builder.Context) error { p := maven.NewProjectWithGAV("org.apache.camel.k.integration", "camel-k-integration", defaults.Version) - p.Properties = ctx.Build.Properties p.DependencyManagement = &maven.DependencyManagement{Dependencies: make([]maven.Dependency, 0)} p.Dependencies = make([]maven.Dependency, 0) p.Build = &maven.Build{Plugins: make([]maven.Plugin, 0)} + p.Properties = make(map[string]string) + for k, v := range ctx.Build.Properties { + p.Properties[k] = v + } + + // camel-quarkus doe routes discovery at startup but we don't want + // this to happen as routes are loaded at runtime and looking for + // routes at build time may try to load camel-k-runtime routes builder + // proxies which in some case may fail + p.Properties["quarkus.camel.main.routes-discovery.enabled"] = "false" + // DependencyManagement p.DependencyManagement.Dependencies = append(p.DependencyManagement.Dependencies, maven.Dependency{ diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go index 3b75eed2b7..fd244383b1 100644 --- a/pkg/trait/quarkus.go +++ b/pkg/trait/quarkus.go @@ -47,6 +47,8 @@ type quarkusTrait struct { QuarkusVersion string `property:"quarkus-version"` // The Camel-Quarkus version to use for the integration CamelQuarkusVersion string `property:"camel-quarkus-version"` + // The Quarkus runtime type (reserved for future use) + Native bool `property:"native"` } func newQuarkusTrait() *quarkusTrait { @@ -156,16 +158,23 @@ func (t *quarkusTrait) addRuntimeDependencies(e *Environment) error { for _, s := range e.Integration.Sources() { meta := metadata.Extract(e.CamelCatalog, s) + lang := s.InferLanguage() - switch language := s.InferLanguage(); language { - case v1alpha1.LanguageYaml: + switch { + case lang == v1alpha1.LanguageYaml: addRuntimeDependency("camel-k-quarkus-loader-yaml", dependencies) - case v1alpha1.LanguageXML: + case lang == v1alpha1.LanguageXML: addRuntimeDependency("camel-k-quarkus-loader-xml", dependencies) - case v1alpha1.LanguageJavaScript: + case lang == v1alpha1.LanguageJavaScript: addRuntimeDependency("camel-k-quarkus-loader-js", dependencies) + case lang == v1alpha1.LanguageGroovy && !t.Native: + addRuntimeDependency("camel-k-quarkus-loader-groovy", dependencies) + case lang == v1alpha1.LanguageKotlin && !t.Native: + addRuntimeDependency("camel-k-quarkus-loader-kotlin", dependencies) + case lang == v1alpha1.LanguageJavaSource && !t.Native: + addRuntimeDependency("camel-k-quarkus-loader-java", dependencies) default: - return fmt.Errorf("unsupported language for Quarkus runtime: %s", language) + return fmt.Errorf("unsupported language for Quarkus runtime: %s (native=%t)", lang, t.Native) } if strings.HasPrefix(s.Loader, "knative-source") {