This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit c2f3fa0765dc52ee20119f6a2c9943895ada5e86
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Fri Jan 17 09:23:31 2020 +0100

    chore(trait): Configure classpath using container args
---
 pkg/trait/classpath.go            | 7 +------
 pkg/trait/knative_service_test.go | 1 -
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/pkg/trait/classpath.go b/pkg/trait/classpath.go
index 6cf1c62..5281477 100644
--- a/pkg/trait/classpath.go
+++ b/pkg/trait/classpath.go
@@ -28,7 +28,6 @@ import (
        k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
-       "github.com/apache/camel-k/pkg/util/envvar"
 )
 
 // The Classpath trait is used internally to configure the classpath of the 
final integration.
@@ -90,11 +89,9 @@ func (t *classpathTrait) Apply(e *Environment) error {
        }
 
        if kit.Labels["camel.apache.org/kit.type"] == 
v1.IntegrationKitTypeExternal {
-               //
                // In case of an external created kit, we do not have any 
information about
                // the classpath so we assume the all jars in 
/deployments/dependencies/ have
                // to be taken into account
-               //
                classpath.Add("/deployments/dependencies/*")
        }
 
@@ -109,13 +106,11 @@ func (t *classpathTrait) Apply(e *Environment) error {
                for _, m := range container.VolumeMounts {
                        classpath.Add(m.MountPath)
                }
-
                items := classpath.List()
-
                // keep classpath sorted
                sort.Strings(items)
 
-               envvar.SetVal(&container.Env, "JAVA_CLASSPATH", 
strings.Join(items, ":"))
+               container.Args = append(container.Args, "-cp", 
strings.Join(items, ":"))
        }
 
        return nil
diff --git a/pkg/trait/knative_service_test.go 
b/pkg/trait/knative_service_test.go
index cd16d2f..92675be 100644
--- a/pkg/trait/knative_service_test.go
+++ b/pkg/trait/knative_service_test.go
@@ -172,7 +172,6 @@ func TestKnativeService(t *testing.T) {
                }
        })
 
-       test.EnvVarExists(t, spec.Containers[0].Env, "JAVA_CLASSPATH")
        test.EnvVarHasValue(t, spec.Containers[0].Env, "CAMEL_K_ROUTES", 
"file:/etc/camel/sources/i-source-000/routes.js?language=js&compression=true")
        test.EnvVarHasValue(t, spec.Containers[0].Env, "CAMEL_K_CONF", 
"/etc/camel/conf/application.properties")
        test.EnvVarHasValue(t, spec.Containers[0].Env, "CAMEL_K_CONF_D", 
"/etc/camel/conf.d")

Reply via email to