You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/11/06 19:41:44 UTC

[GitHub] [camel-k] doru1004 opened a new pull request #1805: Add local-run subcommand with basic support

doru1004 opened a new pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805


   <!-- Description -->
   
   kind/feature
   
   
   <!--
   Enter your extended release note in the below block. If the PR requires
   additional action from users switching to the new release, include the string
   "action required". If no release note is required, write "NONE". 
   
   You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
   the text is added to the right section of the release notes. 
   -->
   
   **Release Note**
   ```release-note
   NONE
   ```
   This patch adds a new subcommand called `local-run` which can run an existing integration locally.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r520831540



##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",

Review comment:
       There is a slight problem here, Cobra doesn't like me having the same name for sub-commands even if they are attached to different parent commands. `kamel run` and `kamel local run` seem to want to share the same flags. I'm getting this error:
   `Error: flag accessed but not defined: source`
   
   As soon as I rename `kamel local run` to something else, it works as expected.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-724612627


   The main class to use is `io.quarkus.runner.GeneratedMain`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r523099254



##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "io.quarkus.runner.GeneratedMain")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-726635353


   Just a minor comment


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-724866053


   > The main class to use is `io.quarkus.runner.GeneratedMain`, you can take the right value from the catalog
   
   Just committed a fix.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r520868453



##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "org.apache.camel.k.main.Application")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))
+
+	// Add directory where the properties file resides.
+	os.Setenv("CAMEL_K_CONF_D", strings.Join(confDirectories(properties), ","))

Review comment:
       Done

##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "org.apache.camel.k.main.Application")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))
+
+	// Add directory where the properties file resides.
+	os.Setenv("CAMEL_K_CONF_D", strings.Join(confDirectories(properties), ","))
+
+	// Add files to the command line under the CAMEL_K_ROUTES flag.
+	os.Setenv("CAMEL_K_ROUTES", strings.Join(formatRoutes(routes), ","))

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-726935962


   @nicolaferraro I managed to address all comments including making the change to "local run".
   
   I have also included the `local run` subcommand to work with existing modeline support thus enabling all options to be used in as modeline options not just dependencies.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r519841132



##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",

Review comment:
       Probably `kamel local run` would be better. So that `kamel local` can have other subcommands if needed in the future.

##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",
+		Short:   "Run a Camel integration locally.",
+		Long:    `Run a Camel integration locally using existing integration files.`,
+		PreRunE: decode(&options),
+		RunE: func(_ *cobra.Command, args []string) error {
+			if err := options.validate(args); err != nil {
+				return err
+			}
+			if err := options.run(args); err != nil {
+				fmt.Println(err.Error())
+			}
+
+			return nil
+		},
+		Annotations: map[string]string{
+			offlineCommandLabel: "true",
+		},
+	}
+
+	cmd.Flags().StringArrayP("properties-file", "p", nil, "File containing integration properties.")

Review comment:
       I'd use the same options as in the `kamel run` command. Not needed to implement all them, but they should have the same syntax. Shortcut `-p` indicates a single property `k=v` in `kamel run` and it should be the same here (with this PR or later on).

##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",
+		Short:   "Run a Camel integration locally.",
+		Long:    `Run a Camel integration locally using existing integration files.`,
+		PreRunE: decode(&options),

Review comment:
       We should also think to load modeline options from the file as well. We can open an issue about modeline in local run.

##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "org.apache.camel.k.main.Application")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))
+
+	// Add directory where the properties file resides.
+	os.Setenv("CAMEL_K_CONF_D", strings.Join(confDirectories(properties), ","))

Review comment:
       This can be better set on `cmd.Env`.

##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "org.apache.camel.k.main.Application")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))
+
+	// Add directory where the properties file resides.
+	os.Setenv("CAMEL_K_CONF_D", strings.Join(confDirectories(properties), ","))
+
+	// Add files to the command line under the CAMEL_K_ROUTES flag.
+	os.Setenv("CAMEL_K_ROUTES", strings.Join(formatRoutes(routes), ","))

Review comment:
       Same




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-724273406


   > I get some errors due to the transition to Quarkus (e.g. main class changed):
   > 
   > ```
   > Caused by: java.lang.ClassNotFoundException: org.apache.camel.k.main.Application
   > ```
   
   I updated the class to:
   
   ```
   org.apache.camel.k.quarkus.Application
   ```
   
   But I am now running into this error:
   
   ```
   Error: Main method not found in class org.apache.camel.k.quarkus.Application, please define the main method as:
      public static void main(String[] args)
   ```
   
   It looks like the main function was removed during the update process, is that intentional? And if so what other class should I be using instead. There seems to be no main class in any of the camel-k-runtime files.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 edited a comment on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 edited a comment on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-726935962


   @nicolaferraro I managed to address all comments including making the change to "local run".
   
   I have also included the `local run` subcommand to work with existing modeline support thus enabling all options to be used in as modeline options not just dependencies.
   
   I have also rebased this PR on latest master.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli edited a comment on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-724612627


   The main class to use is `io.quarkus.runner.GeneratedMain`, you can take the right value from the catalog


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r522806065



##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "io.quarkus.runner.GeneratedMain")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))

Review comment:
       I think it's ok to keep it. The container on Kube prints this as well.

##########
File path: pkg/cmd/util_commands.go
##########
@@ -0,0 +1,97 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"os"
+	"os/exec"
+	"path"
+	"strings"
+)
+
+var (
+	ctx9, cancel9 = context.WithCancel(context.Background()) // preemptive: kill subprocess
+	ctx, cancel   = context.WithCancel(ctx9)                 // cooperative: wait for subprocess
+)
+
+func formatRoutes(files []string) []string {
+	routes := []string{}
+	for _, route := range files {
+		// Split route path.
+		a := strings.Split(route, ".")
+
+		// Extract extension.
+		extension := a[len(a)-1]
+
+		// Add file if extension is supported.
+		routes = append(routes, "file:"+route+"?language="+extension)
+	}
+
+	return routes
+}
+
+func confDirectories(properties []string) []string {
+	confDirs := []string{}
+
+	for _, propertiesPath := range properties {
+		confDirs = append(confDirs, path.Dir(propertiesPath))
+	}
+
+	return confDirs
+}
+
+func assembleClasspatchArgValue(properties []string, dependencies []string, routes []string) string {
+	classpathContents := []string{}
+	classpathContents = append(classpathContents, properties...)
+	classpathContents = append(classpathContents, routes...)
+	classpathContents = append(classpathContents, dependencies...)
+	return strings.Join(classpathContents, ":")
+}
+
+// RunLocalIntegration --
+func RunLocalIntegration(properties []string, dependencies []string, routes []string) error {
+	// Create classpath value.
+	classpathValue := assembleClasspatchArgValue(properties, dependencies, routes)
+
+	// Create java command that runs the integration.
+	javaCmd := "java"
+
+	// Create java command arguments.
+	args := make([]string, 0)
+	args = append(args, "-cp")
+	args = append(args, classpathValue)
+	args = append(args, "io.quarkus.runner.GeneratedMain")
+
+	cmd := exec.CommandContext(ctx, javaCmd, args...)
+	cmd.Stderr = os.Stderr
+	cmd.Stdout = os.Stdout
+	// cmd.Dir = ctx.Path
+
+	// TODO: for debug purposes, remove when done.
+	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))

Review comment:
       Probably I'd remove the `outputDependencies` call that prints the list of dependencies before it:
   
   ```
   [nferraro@localhost camel-k]$ kamel local-run examples/routes.js 
   /home/nferraro/.m2/repository/org/apache/camel/quarkus/camel-quarkus-timer/1.1.0/camel-quarkus-timer-1.1.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/quarkus/camel-quarkus-core/1.1.0/camel-quarkus-core-1.1.0.jar
   /home/nferraro/.m2/repository/io/quarkus/quarkus-core/1.8.0.Final/quarkus-core-1.8.0.Final.jar
   /home/nferraro/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar
   /home/nferraro/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar
   /home/nferraro/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar
   /home/nferraro/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar
   /home/nferraro/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar
   /home/nferraro/.m2/repository/io/quarkus/quarkus-ide-launcher/1.8.0.Final/quarkus-ide-launcher-1.8.0.Final.jar
   /home/nferraro/.m2/repository/io/smallrye/config/smallrye-config/1.8.6/smallrye-config-1.8.6.jar
   /home/nferraro/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.3.0/smallrye-common-annotation-1.3.0.jar
   /home/nferraro/.m2/repository/io/smallrye/config/smallrye-config-common/1.8.6/smallrye-config-common-1.8.6.jar
   /home/nferraro/.m2/repository/io/smallrye/common/smallrye-common-expression/1.1.0/smallrye-common-expression-1.1.0.jar
   /home/nferraro/.m2/repository/io/smallrye/common/smallrye-common-function/1.1.0/smallrye-common-function-1.1.0.jar
   /home/nferraro/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.1.0/smallrye-common-constraint-1.1.0.jar
   /home/nferraro/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar
   /home/nferraro/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.4/jboss-logmanager-embedded-1.0.4.jar
   /home/nferraro/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.1.0.Final/jboss-logging-annotations-2.1.0.Final.jar
   /home/nferraro/.m2/repository/org/jboss/threads/jboss-threads/3.1.1.Final/jboss-threads-3.1.1.Final.jar
   /home/nferraro/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar
   /home/nferraro/.m2/repository/org/jboss/slf4j/slf4j-jboss-logging/1.2.0.Final/slf4j-jboss-logging-1.2.0.Final.jar
   /home/nferraro/.m2/repository/org/graalvm/sdk/graal-sdk/20.2.0/graal-sdk-20.2.0.jar
   /home/nferraro/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar
   /home/nferraro/.m2/repository/io/quarkus/quarkus-bootstrap-runner/1.8.0.Final/quarkus-bootstrap-runner-1.8.0.Final.jar
   /home/nferraro/.m2/repository/io/quarkus/quarkus-arc/1.8.0.Final/quarkus-arc-1.8.0.Final.jar
   /home/nferraro/.m2/repository/io/quarkus/arc/arc/1.8.0.Final/arc-1.8.0.Final.jar
   /home/nferraro/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar
   /home/nferraro/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.0.1/microprofile-context-propagation-api-1.0.1.jar
   /home/nferraro/.m2/repository/org/apache/camel/quarkus/camel-quarkus-support-common/1.1.0/camel-quarkus-support-common-1.1.0.jar
   /home/nferraro/.m2/repository/io/quarkus/quarkus-development-mode-spi/1.8.0.Final/quarkus-development-mode-spi-1.8.0.Final.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-core-engine/3.5.0/camel-core-engine-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-api/3.5.0/camel-api-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-management-api/3.5.0/camel-management-api-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-util/3.5.0/camel-util-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-base/3.5.0/camel-base-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-core-languages/3.5.0/camel-core-languages-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-endpointdsl/3.5.0/camel-endpointdsl-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-componentdsl/3.5.0/camel-componentdsl-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-core-catalog/3.5.0/camel-core-catalog-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-tooling-model/3.5.0/camel-tooling-model-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-util-json/3.5.0/camel-util-json-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-microprofile-config/3.5.0/camel-microprofile-config-3.5.0.jar
   /home/nferraro/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/1.4/microprofile-config-api-1.4.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-timer/3.5.0/camel-timer-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-support/3.5.0/camel-support-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/quarkus/camel-quarkus-log/1.1.0/camel-quarkus-log-1.1.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/camel-log/3.5.0/camel-log-3.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-quarkus-loader-js/1.5.0/camel-k-quarkus-loader-js-1.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-quarkus-core/1.5.0/camel-k-quarkus-core-1.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-runtime-core/1.5.0/camel-k-runtime-core-1.5.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/quarkus/camel-quarkus-endpointdsl/1.1.0/camel-quarkus-endpointdsl-1.1.0.jar
   /home/nferraro/.m2/repository/org/apache/camel/k/camel-k-loader-js/1.5.0/camel-k-loader-js-1.5.0.jar
   /home/nferraro/.m2/repository/org/graalvm/js/js/20.2.0/js-20.2.0.jar
   /home/nferraro/.m2/repository/org/graalvm/regex/regex/20.2.0/regex-20.2.0.jar
   /home/nferraro/.m2/repository/org/graalvm/truffle/truffle-api/20.2.0/truffle-api-20.2.0.jar
   /home/nferraro/.m2/repository/org/ow2/asm/asm/8.0.1/asm-8.0.1.jar
   /home/nferraro/.m2/repository/org/ow2/asm/asm-tree/8.0.1/asm-tree-8.0.1.jar
   /home/nferraro/.m2/repository/org/ow2/asm/asm-analysis/8.0.1/asm-analysis-8.0.1.jar
   /home/nferraro/.m2/repository/org/ow2/asm/asm-commons/7.1/asm-commons-7.1.jar
   /home/nferraro/.m2/repository/org/ow2/asm/asm-util/7.1/asm-util-7.1.jar
   /home/nferraro/.m2/repository/com/ibm/icu/icu4j/67.1/icu4j-67.1.jar
   /tmp/maven-877782304/target/camel-k-integration-1.3.0-SNAPSHOT-runner.jar
   executing: java -cp examples/routes.js:/home/nferraro/.m2/repository/org/apache
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r521595939



##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",
+		Short:   "Run a Camel integration locally.",
+		Long:    `Run a Camel integration locally using existing integration files.`,
+		PreRunE: decode(&options),

Review comment:
       I added support for modeline dependencies only. Do we want to support other option types?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 edited a comment on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 edited a comment on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-724273406


   > I get some errors due to the transition to Quarkus (e.g. main class changed):
   > 
   > ```
   > Caused by: java.lang.ClassNotFoundException: org.apache.camel.k.main.Application
   > ```
   
   I updated the class to:
   
   ```
   org.apache.camel.k.quarkus.Application
   ```
   
   But I am now running into this error:
   
   ```
   Error: Main method not found in class org.apache.camel.k.quarkus.Application, please define the main method as:
      public static void main(String[] args)
   ```
   
   It looks like the main function was removed during the update process, is that intentional? And if so what other class should I be using instead. There seems to be no main method in any of the camel-k-runtime files.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on pull request #1805: Add local run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-728845994


   Great!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-724596189


   > > I get some errors due to the transition to Quarkus (e.g. main class changed):
   > > ```
   > > Caused by: java.lang.ClassNotFoundException: org.apache.camel.k.main.Application
   > > ```
   > 
   > I updated the class to:
   > 
   > ```
   > org.apache.camel.k.quarkus.Application
   > ```
   > 
   > But I am now running into this error:
   > 
   > ```
   > Error: Main method not found in class org.apache.camel.k.quarkus.Application, please define the main method as:
   >    public static void main(String[] args)
   > ```
   > 
   > It looks like the main function was removed during the update process, is that intentional? And if so what other class should I be using instead. There seems to be no main method in any of the camel-k-runtime files.
   
   Yes, that changes a bit with Quarkus. If you look at integrations running on Kube (I'm using latest from master), you see it's using: `io.quarkus.runner.GeneratedMain`.
   
   @lburgazzoli may help here.
   
   
   ```
   exec java -cp ./resources:/etc/camel/conf:/etc/camel/resources:/etc/camel/sources/i-source-000:dependencies/camel-k-integration-1.3.0-SNAPSHOT-runner.jar:dependencies/io.quarkus.arc.arc-1.9.0.Final.jar:dependencies/io.quarkus.quarkus-arc-1.9.0.Final.jar:dependencies/io.quarkus.quarkus-bootstrap-runner-1.9.0.Final.jar:dependencies/io.quarkus.quarkus-core-1.9.0.Final.jar:dependencies/io.quarkus.quarkus-development-mode-spi-1.9.0.Final.jar:dependencies/io.quarkus.quarkus-ide-launcher-1.9.0.Final.jar:dependencies/io.smallrye.common.smallrye-common-annotation-1.4.0.jar:dependencies/io.smallrye.common.smallrye-common-classloader-1.4.0.jar:dependencies/io.smallrye.common.smallrye-common-constraint-1.4.0.jar:dependencies/io.smallrye.common.smallrye-common-expression-1.4.0.jar:dependencies/io.smallrye.common.smallrye-common-function-1.4.0.jar:dependencies/io.smallrye.config.smallrye-config-1.9.1.jar:dependencies/io.smallrye.config.smallrye-config-common-1.9.1.jar:dependencies/jakarta.annot
 ation.jakarta.annotation-api-1.3.5.jar:dependencies/jakarta.el.jakarta.el-api-3.0.3.jar:dependencies/jakarta.enterprise.jakarta.enterprise.cdi-api-2.0.2.jar:dependencies/jakarta.inject.jakarta.inject-api-1.0.jar:dependencies/jakarta.interceptor.jakarta.interceptor-api-1.2.5.jar:dependencies/jakarta.transaction.jakarta.transaction-api-1.3.3.jar:dependencies/org.apache.camel.camel-api-3.6.0.jar:dependencies/org.apache.camel.camel-base-3.6.0.jar:dependencies/org.apache.camel.camel-bean-3.6.0.jar:dependencies/org.apache.camel.camel-componentdsl-3.6.0.jar:dependencies/org.apache.camel.camel-core-catalog-3.6.0.jar:dependencies/org.apache.camel.camel-core-engine-3.6.0.jar:dependencies/org.apache.camel.camel-core-languages-3.6.0.jar:dependencies/org.apache.camel.camel-endpointdsl-3.6.0.jar:dependencies/org.apache.camel.camel-groovy-3.6.0.jar:dependencies/org.apache.camel.camel-log-3.6.0.jar:dependencies/org.apache.camel.camel-main-3.6.0.jar:dependencies/org.apache.camel.camel-management-api
 -3.6.0.jar:dependencies/org.apache.camel.camel-microprofile-config-3.6.0.jar:dependencies/org.apache.camel.camel-support-3.6.0.jar:dependencies/org.apache.camel.camel-timer-3.6.0.jar:dependencies/org.apache.camel.camel-tooling-model-3.6.0.jar:dependencies/org.apache.camel.camel-util-3.6.0.jar:dependencies/org.apache.camel.camel-util-json-3.6.0.jar:dependencies/org.apache.camel.k.camel-k-core-1.6.0-SNAPSHOT.jar:dependencies/org.apache.camel.k.camel-k-core-api-1.6.0-SNAPSHOT.jar:dependencies/org.apache.camel.k.camel-k-core-support-1.6.0-SNAPSHOT.jar:dependencies/org.apache.camel.k.camel-k-loader-groovy-1.6.0-SNAPSHOT.jar:dependencies/org.apache.camel.k.camel-k-loader-groovy-impl-1.6.0-SNAPSHOT.jar:dependencies/org.apache.camel.k.camel-k-runtime-1.6.0-SNAPSHOT.jar:dependencies/org.apache.camel.quarkus.camel-quarkus-bean-1.3.0.jar:dependencies/org.apache.camel.quarkus.camel-quarkus-core-1.3.0.jar:dependencies/org.apache.camel.quarkus.camel-quarkus-endpointdsl-1.3.0.jar:dependencies/org.
 apache.camel.quarkus.camel-quarkus-log-1.3.0.jar:dependencies/org.apache.camel.quarkus.camel-quarkus-main-1.3.0.jar:dependencies/org.apache.camel.quarkus.camel-quarkus-support-common-1.3.0.jar:dependencies/org.apache.camel.quarkus.camel-quarkus-timer-1.3.0.jar:dependencies/org.codehaus.groovy.groovy-3.0.5.jar:dependencies/org.eclipse.microprofile.config.microprofile-config-api-1.4.jar:dependencies/org.eclipse.microprofile.context-propagation.microprofile-context-propagation-api-1.0.1.jar:dependencies/org.graalvm.sdk.graal-sdk-20.2.0.jar:dependencies/org.jboss.logging.jboss-logging-3.4.1.Final.jar:dependencies/org.jboss.logging.jboss-logging-annotations-2.1.0.Final.jar:dependencies/org.jboss.logmanager.jboss-logmanager-embedded-1.0.5.jar:dependencies/org.jboss.slf4j.slf4j-jboss-logging-1.2.0.Final.jar:dependencies/org.jboss.threads.jboss-threads-3.1.1.Final.jar:dependencies/org.ow2.asm.asm-8.0.1.jar:dependencies/org.slf4j.slf4j-api-1.7.30.jar:dependencies/org.wildfly.common.wildfly-c
 ommon-1.5.4.Final-format-001.jar io.quarkus.runner.GeneratedMain
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r520831783



##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",
+		Short:   "Run a Camel integration locally.",
+		Long:    `Run a Camel integration locally using existing integration files.`,
+		PreRunE: decode(&options),
+		RunE: func(_ *cobra.Command, args []string) error {
+			if err := options.validate(args); err != nil {
+				return err
+			}
+			if err := options.run(args); err != nil {
+				fmt.Println(err.Error())
+			}
+
+			return nil
+		},
+		Annotations: map[string]string{
+			offlineCommandLabel: "true",
+		},
+	}
+
+	cmd.Flags().StringArrayP("properties-file", "p", nil, "File containing integration properties.")

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 edited a comment on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 edited a comment on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-726935962


   @nicolaferraro I managed to address all comments including making the change to "local run".
   
   I have also included the `local run` subcommand to work with existing modeline support thus enabling all options to be used as modeline options not just dependencies.
   
   I have also rebased this PR on latest master.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r523131883



##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",
+		Short:   "Run a Camel integration locally.",
+		Long:    `Run a Camel integration locally using existing integration files.`,
+		PreRunE: decode(&options),

Review comment:
       I added support for all modeline options.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on a change in pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
doru1004 commented on a change in pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#discussion_r523131277



##########
File path: pkg/cmd/local_run.go
##########
@@ -0,0 +1,110 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cmd
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/cobra"
+)
+
+func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCmdOptions) {
+	options := localRunCmdOptions{
+		RootCmdOptions: rootCmdOptions,
+	}
+
+	cmd := cobra.Command{
+		Use:     "local-run [files to inspect]",

Review comment:
       Added `local run` command.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro merged pull request #1805: Add local run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
nicolaferraro merged pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on pull request #1805: Add local-run subcommand with basic support

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on pull request #1805:
URL: https://github.com/apache/camel-k/pull/1805#issuecomment-726604090


   @nicolaferraro mind doing another review ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org