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 2022/01/04 08:45:41 UTC

[GitHub] [camel] davsclaus commented on a change in pull request #6583: CAMEL-17345: camel-jbang create maven project

davsclaus commented on a change in pull request #6583:
URL: https://github.com/apache/camel/pull/6583#discussion_r777909203



##########
File path: dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Project.java
##########
@@ -0,0 +1,160 @@
+/*
+ * 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 org.apache.camel.dsl.jbang.core.commands;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateExceptionHandler;
+import org.apache.camel.dsl.jbang.core.generator.CamelJbangGenerator;
+import org.apache.camel.dsl.jbang.core.generator.QuarkusGenerator;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "create-project", description = "Creates Camel-Quarkus project")
+public class Project implements Callable<Integer> {
+
+    private static final String PACKAGE_REGEX = "package\\s+([a-zA_Z_][\\.\\w]*);";
+    private static final Pattern PACKAGE_PATTERN = Pattern.compile(PACKAGE_REGEX);
+    @CommandLine.Parameters(description = "The Camel file(s) to include in the created project", arity = "1")
+    private String[] files;
+    @CommandLine.Option(names = { "-h", "--help" }, usageHelp = true, description = "Display the help and sub-commands")
+    private boolean helpRequested;
+    @CommandLine.Option(names = { "-n", "--name" }, description = "The name of the Camel application",
+                        defaultValue = "CamelJBang")
+    private String name;
+    @CommandLine.Option(names = { "-g", "--group-id" }, description = "The group ID of the maven project",
+                        defaultValue = "org.apache.camel.jbang")
+    private String groupId;
+    @CommandLine.Option(names = { "-d", "--directory" }, description = "Directory where the project will be created",
+                        defaultValue = ".")
+    private String baseDirectory;
+    @CommandLine.Option(names = "--quarkus-dependency", description = "Comma separated list of camel-quarkus dependencies",
+                        defaultValue = "camel-quarkus-timer,camel-quarkus-log,camel-quarkus-yaml-dsl,camel-quarkus-kamelet,org.apache.camel.kamelets:camel-kamelets-catalog:0.5.0")

Review comment:
       We upgraded to kamelet 0.6.0

##########
File path: dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Project.java
##########
@@ -0,0 +1,160 @@
+/*
+ * 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 org.apache.camel.dsl.jbang.core.commands;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateExceptionHandler;
+import org.apache.camel.dsl.jbang.core.generator.CamelJbangGenerator;
+import org.apache.camel.dsl.jbang.core.generator.QuarkusGenerator;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "create-project", description = "Creates Camel-Quarkus project")
+public class Project implements Callable<Integer> {
+
+    private static final String PACKAGE_REGEX = "package\\s+([a-zA_Z_][\\.\\w]*);";
+    private static final Pattern PACKAGE_PATTERN = Pattern.compile(PACKAGE_REGEX);
+    @CommandLine.Parameters(description = "The Camel file(s) to include in the created project", arity = "1")
+    private String[] files;
+    @CommandLine.Option(names = { "-h", "--help" }, usageHelp = true, description = "Display the help and sub-commands")
+    private boolean helpRequested;
+    @CommandLine.Option(names = { "-n", "--name" }, description = "The name of the Camel application",
+                        defaultValue = "CamelJBang")
+    private String name;
+    @CommandLine.Option(names = { "-g", "--group-id" }, description = "The group ID of the maven project",
+                        defaultValue = "org.apache.camel.jbang")
+    private String groupId;
+    @CommandLine.Option(names = { "-d", "--directory" }, description = "Directory where the project will be created",
+                        defaultValue = ".")
+    private String baseDirectory;
+    @CommandLine.Option(names = "--quarkus-dependency", description = "Comma separated list of camel-quarkus dependencies",
+                        defaultValue = "camel-quarkus-timer,camel-quarkus-log,camel-quarkus-yaml-dsl,camel-quarkus-kamelet,org.apache.camel.kamelets:camel-kamelets-catalog:0.5.0")
+    private String quarkusDependencies;
+    @CommandLine.Option(names = "--quarkus-bom-version", description = "Override quarkus bom version in pom.xml",
+                        defaultValue = "2.5.0.Final")

Review comment:
       Use 2.6.0.Final




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