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 2021/11/05 14:43:11 UTC

[GitHub] [camel-k] dweber019 opened a new pull request #2731: Add pojo-jar example

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


   originally from https://github.com/dweber019/camel-k-jar.
   
   See https://github.com/apache/camel-k/issues/1821#issuecomment-961683471
   


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] astefanutti commented on pull request #2731: Add pojo-jar example

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


   Yes, I agree we can have it merged here and continue the discussion about examples location in a larger context.


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] dweber019 commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/.gitignore
##########
@@ -0,0 +1,27 @@
+# Compiled class file

Review comment:
       Removed




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] astefanutti commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java
##########
@@ -0,0 +1,53 @@
+// camel-k: name=pojo-jar
+// camel-k: dependency=camel-jackson
+// camel-k: dependency=camel-openapi-java
+// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.22
+// camel-k: resource=file:../../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       Ah right, the resources are resolved relative to the current file location.




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] astefanutti commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api

Review comment:
       I'd suggest to replace `This repository` with something like `This example ports the following examples to Camel K`.

##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 
+```xml
+<plugin>
+<groupId>org.apache.maven.plugins</groupId>
+<artifactId>maven-jar-plugin</artifactId>
+<version>3.2.0</version>
+<configuration>
+  <archive>
+    <manifest>
+      <addClasspath>true</addClasspath>
+      <classpathPrefix>libs/</classpathPrefix>
+    </manifest>
+  </archive>
+  <excludes>
+    **/*Route*
+  </excludes>
+</configuration>
+</plugin>
+```
+Be aware that you have to exclude the route file (`OpenApiRoute.java`) as this file will already be provided over the
+`kamel run ...` CLI.
+
+### Include the JAR
+Now that you have the source code packed in the jar file you have to provide this jar file to the Camel K container,
+where your Camel K route is running.  
+You can do this by adding the following (modelines)[https://camel.apache.org/camel-k/1.6.x/cli/modeline.html]
+to your route file (`OpenApiRoute.java`).
+```
+// camel-k: resource=file:../../../../../target/pojo-jar-1.0.0.jar
+// camel-k: trait=jvm.classpath=/etc/camel/resources/pojo-jar-1.0.0.jar
+```
+It's important to add the jar file as resource to be compressed.

Review comment:
       nit: `jar` -> `JAR`.

##########
File path: examples/pojo-jar/.gitignore
##########
@@ -0,0 +1,27 @@
+# Compiled class file

Review comment:
       Is that file really needed? There already is a top-level `.gitignore` file in this repository.

##########
File path: examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java
##########
@@ -0,0 +1,53 @@
+// camel-k: name=pojo-jar
+// camel-k: dependency=camel-jackson
+// camel-k: dependency=camel-openapi-java
+// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.22

Review comment:
       Would this be possible to remove Lombok to keep the example un-opinionated?

##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 

Review comment:
       Would it be better to point to the POM and Java file, and provide the command to run to build the POJO archive?

##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 
+```xml
+<plugin>
+<groupId>org.apache.maven.plugins</groupId>
+<artifactId>maven-jar-plugin</artifactId>
+<version>3.2.0</version>
+<configuration>
+  <archive>
+    <manifest>
+      <addClasspath>true</addClasspath>
+      <classpathPrefix>libs/</classpathPrefix>
+    </manifest>
+  </archive>
+  <excludes>
+    **/*Route*
+  </excludes>
+</configuration>
+</plugin>
+```
+Be aware that you have to exclude the route file (`OpenApiRoute.java`) as this file will already be provided over the
+`kamel run ...` CLI.
+
+### Include the JAR
+Now that you have the source code packed in the jar file you have to provide this jar file to the Camel K container,
+where your Camel K route is running.  
+You can do this by adding the following (modelines)[https://camel.apache.org/camel-k/1.6.x/cli/modeline.html]
+to your route file (`OpenApiRoute.java`).
+```
+// camel-k: resource=file:../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       Is the path right? Also I wonder whether the actual JAR could be checked-in, so that the example can be run without having to build the POJO archive.




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] dweber019 commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/.gitignore
##########
@@ -0,0 +1,27 @@
+# Compiled class file

Review comment:
       Will remove it




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] oscerd commented on pull request #2731: Add pojo-jar example

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


   LGTM, but I think we should maintain examples in a separated repository like we have here: https://github.com/apache/camel-k-examples
   
   Or if we don't want to have it separated, we need to discontinue the repository.


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] oscerd commented on pull request #2731: Add pojo-jar example

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


   I think we have everything we need, eventually we'll move the example in the other repo, but for the moment it's all ok. Lets wait for @astefanutti and  @davsclaus :-)


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] dweber019 commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api

Review comment:
       changed

##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 
+```xml
+<plugin>
+<groupId>org.apache.maven.plugins</groupId>
+<artifactId>maven-jar-plugin</artifactId>
+<version>3.2.0</version>
+<configuration>
+  <archive>
+    <manifest>
+      <addClasspath>true</addClasspath>
+      <classpathPrefix>libs/</classpathPrefix>
+    </manifest>
+  </archive>
+  <excludes>
+    **/*Route*
+  </excludes>
+</configuration>
+</plugin>
+```
+Be aware that you have to exclude the route file (`OpenApiRoute.java`) as this file will already be provided over the
+`kamel run ...` CLI.
+
+### Include the JAR
+Now that you have the source code packed in the jar file you have to provide this jar file to the Camel K container,
+where your Camel K route is running.  
+You can do this by adding the following (modelines)[https://camel.apache.org/camel-k/1.6.x/cli/modeline.html]
+to your route file (`OpenApiRoute.java`).
+```
+// camel-k: resource=file:../../../../../target/pojo-jar-1.0.0.jar
+// camel-k: trait=jvm.classpath=/etc/camel/resources/pojo-jar-1.0.0.jar
+```
+It's important to add the jar file as resource to be compressed.

Review comment:
       done

##########
File path: examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java
##########
@@ -0,0 +1,53 @@
+// camel-k: name=pojo-jar
+// camel-k: dependency=camel-jackson
+// camel-k: dependency=camel-openapi-java
+// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.22

Review comment:
       Yes sure. @davsclaus what do you think as you explicitly asked for it in the issue comment.

##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 

Review comment:
       removed the xml and added mvn install command

##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 
+```xml
+<plugin>
+<groupId>org.apache.maven.plugins</groupId>
+<artifactId>maven-jar-plugin</artifactId>
+<version>3.2.0</version>
+<configuration>
+  <archive>
+    <manifest>
+      <addClasspath>true</addClasspath>
+      <classpathPrefix>libs/</classpathPrefix>
+    </manifest>
+  </archive>
+  <excludes>
+    **/*Route*
+  </excludes>
+</configuration>
+</plugin>
+```
+Be aware that you have to exclude the route file (`OpenApiRoute.java`) as this file will already be provided over the
+`kamel run ...` CLI.
+
+### Include the JAR
+Now that you have the source code packed in the jar file you have to provide this jar file to the Camel K container,
+where your Camel K route is running.  
+You can do this by adding the following (modelines)[https://camel.apache.org/camel-k/1.6.x/cli/modeline.html]
+to your route file (`OpenApiRoute.java`).
+```
+// camel-k: resource=file:../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       Added the JAR file to git and fixed path




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] astefanutti edited a comment on pull request #2731: Add pojo-jar example

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


   Yes, I agree we can have it merged here and continue the discussion about examples location in a larger context.


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] dweber019 commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java
##########
@@ -0,0 +1,53 @@
+// camel-k: name=pojo-jar
+// camel-k: dependency=camel-jackson
+// camel-k: dependency=camel-openapi-java
+// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.22
+// camel-k: resource=file:../../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       I did run the command like this and it worked. I think as it's defined as modeline the cwd/pwd is the java file I define in the kamel command. README => kamel run ./src/main/org/apache/camel/OpenApiRoute.java
   So kamel changes the execution location to ./src/main/org/apache/camel/OpenApiRoute.java




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] dweber019 commented on pull request #2731: Add pojo-jar example

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


   @oscerd @astefanutti @davsclaus do you need any assistance from my side?


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] astefanutti commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/README.md
##########
@@ -0,0 +1,48 @@
+# camel-k-jar
+This repository takes the example from here https://camel.apache.org/manual/rest-dsl.html#_openapi_swagger_api
+and here https://github.com/apache/camel-examples/tree/camel-3.11.x/examples/openapi-cdi and make it work with Camel K.
+
+Target of this setup was to make the local development experience better,
+by providing a way to use not only inner classes in route file (`OpenApiRoute.java`) and avoid using
+Maven or jitpack, which add major round trips to the development cycle.
+
+## Solution
+### Build a JAR
+First you need to build a jar file of your source code. For example by 
+```xml
+<plugin>
+<groupId>org.apache.maven.plugins</groupId>
+<artifactId>maven-jar-plugin</artifactId>
+<version>3.2.0</version>
+<configuration>
+  <archive>
+    <manifest>
+      <addClasspath>true</addClasspath>
+      <classpathPrefix>libs/</classpathPrefix>
+    </manifest>
+  </archive>
+  <excludes>
+    **/*Route*
+  </excludes>
+</configuration>
+</plugin>
+```
+Be aware that you have to exclude the route file (`OpenApiRoute.java`) as this file will already be provided over the
+`kamel run ...` CLI.
+
+### Include the JAR
+Now that you have the source code packed in the jar file you have to provide this jar file to the Camel K container,
+where your Camel K route is running.  
+You can do this by adding the following (modelines)[https://camel.apache.org/camel-k/1.6.x/cli/modeline.html]
+to your route file (`OpenApiRoute.java`).
+```
+// camel-k: resource=file:../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       Shouldn't it be `// camel-k: resource=file:./target/pojo-jar-1.0.0.jar`?

##########
File path: examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java
##########
@@ -0,0 +1,53 @@
+// camel-k: name=pojo-jar
+// camel-k: dependency=camel-jackson
+// camel-k: dependency=camel-openapi-java
+// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.22
+// camel-k: resource=file:../../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       Shouldn't it be `// camel-k: resource=file:./target/pojo-jar-1.0.0.jar`?




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] davsclaus commented on a change in pull request #2731: Add pojo-jar example

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



##########
File path: examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java
##########
@@ -0,0 +1,53 @@
+// camel-k: name=pojo-jar
+// camel-k: dependency=camel-jackson
+// camel-k: dependency=camel-openapi-java
+// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.22
+// camel-k: resource=file:../../../../../../target/pojo-jar-1.0.0.jar

Review comment:
       Yes can we avoid all these weird parent folder?




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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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



[GitHub] [camel-k] astefanutti merged pull request #2731: Add pojo-jar example

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


   


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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