Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local run subcommand with basic support #1805

Merged
merged 12 commits into from
Nov 17, 2020

Conversation

doru1004
Copy link
Contributor

@doru1004 doru1004 commented Nov 6, 2020

This patch adds a new subcommand called local run which can run an existing integration locally.

Release Note

Integrations can be executed locally using the "kamel local run" command

Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, it looks promising.
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

Do you mind adding some e2e tests about local run and depdencies, we can execute them in Github actions so things don't easily break.

pkg/cmd/local_run.go Outdated Show resolved Hide resolved
pkg/cmd/local_run.go Outdated Show resolved Hide resolved
pkg/cmd/local_run.go Show resolved Hide resolved
pkg/cmd/util_commands.go Outdated Show resolved Hide resolved
pkg/cmd/util_commands.go Outdated Show resolved Hide resolved
@doru1004
Copy link
Contributor Author

doru1004 commented Nov 9, 2020

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.

@nicolaferraro
Copy link
Member

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.annotation.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-common-1.5.4.Final-format-001.jar io.quarkus.runner.GeneratedMain

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Nov 10, 2020

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

@doru1004
Copy link
Contributor Author

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

Just committed a fix.

@lburgazzoli
Copy link
Contributor

@nicolaferraro mind doing another review ?

Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds really good!

pkg/cmd/util_commands.go Show resolved Hide resolved
@nicolaferraro
Copy link
Member

Just a minor comment

@doru1004
Copy link
Contributor Author

doru1004 commented Nov 13, 2020

@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.

@doru1004 doru1004 changed the title Add local-run subcommand with basic support Add local run subcommand with basic support Nov 13, 2020
@nicolaferraro nicolaferraro added the kind/feature New feature or request label Nov 17, 2020
@nicolaferraro
Copy link
Member

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants