You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2020/01/24 17:09:05 UTC

[camel-k] 04/07: feat(JVM): Add a JVM options option to the JVM trait

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 ada13cc92a1facff00a4e665fdef222c22c2603f
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Jan 23 14:48:33 2020 +0100

    feat(JVM): Add a JVM options option to the JVM trait
---
 docs/modules/ROOT/pages/traits/jvm.adoc | 6 +++++-
 pkg/trait/jvm.go                        | 8 ++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/docs/modules/ROOT/pages/traits/jvm.adoc b/docs/modules/ROOT/pages/traits/jvm.adoc
index 2ae6152..530c1a7 100755
--- a/docs/modules/ROOT/pages/traits/jvm.adoc
+++ b/docs/modules/ROOT/pages/traits/jvm.adoc
@@ -14,7 +14,7 @@ WARNING: The jvm trait is a *platform trait*: disabling it may compromise the pl
 
 Trait properties can be specified when running any integration with the CLI:
 ```
-kamel run --trait jvm.[key]=[value] integration.groovy
+kamel run --trait jvm.[key]=[value] --trait jvm.[key2]=[value2] integration.groovy
 ```
 The following configuration options are available:
 
@@ -26,6 +26,10 @@ The following configuration options are available:
 | bool
 | Can be used to enable or disable a trait. All traits share this common property.
 
+| jvm.options
+| string
+| A comma-separated list of JVM options
+
 |===
 
 // End of autogenerated code - DO NOT EDIT! (configuration)
diff --git a/pkg/trait/jvm.go b/pkg/trait/jvm.go
index c09e46d..348e093 100644
--- a/pkg/trait/jvm.go
+++ b/pkg/trait/jvm.go
@@ -40,6 +40,9 @@ const (
 // +camel-k:trait=jvm
 type jvmTrait struct {
 	BaseTrait `property:",squash"`
+
+	// A comma-separated list of JVM options
+	Options *string `property:"options"`
 }
 
 func newJvmTrait() *jvmTrait {
@@ -104,6 +107,11 @@ func (t *jvmTrait) Apply(e *Environment) error {
 		container.Command = []string{"java"}
 		container.WorkingDir = "/deployments"
 
+		// Add JVM options
+		if t.Options != nil {
+			container.Args = append(container.Args, strings.Split(*t.Options, ",")...)
+		}
+
 		// Add mounted resources to the class path
 		for _, m := range container.VolumeMounts {
 			classpath.Add(m.MountPath)