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

creation of extension on windows failed #2999

Closed
dufoli opened this issue Aug 9, 2021 · 3 comments · Fixed by #3008
Closed

creation of extension on windows failed #2999

dufoli opened this issue Aug 9, 2021 · 3 comments · Fixed by #3008
Milestone

Comments

@dufoli
Copy link
Contributor

dufoli commented Aug 9, 2021

OS : Windows

mvn cq:create -N -Dcq.artifactIdBase=cxf

error log:
[ERROR] Failed to execute goal org.l2x6.cq:cq-maven-plugin:0.38.0:create (default-cli) on project camel-quarkus: Execution default-cli of goal org.l2x6.cq:cq-maven-plugin:0.38.0:create failed: Illegal character [:] in path at index 4: ///D:\src\camel-quarkus/tooling/create-extension-templates -> [Help 1]

it come from main pom.xml:

<templatesUriBase>file:///${project.basedir}/tooling/create-extension-templates</templatesUriBase>

and it is used in org.apache.camel.quarkus.maven.CqUtils

templatesUriBase on my desktop was : file:///D:\src\camel-quarkus/tooling/create-extension-templates
FILE_PREFIX is removed so I end with "///D:\src\camel-quarkus/tooling/create-extension-templates" in createTemplateLoader

I think uri on windows must be D:\src\camel-quarkus\tooling\create-extension-templates

quick hack is maybe just in org.apache.camel.quarkus.maven.CqUtils.createTemplateLoader :

diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqUtils.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqUtils.java
index d74490355..57a78ff60 100644
--- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqUtils.java
+++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CqUtils.java
@@ -63,7 +63,13 @@ public class CqUtils {
                             defaultLoader //
                     });
         } else if (templatesUriBase.startsWith(FILE_PREFIX)) {
-            final Path resolvedTemplatesDir = basePath.resolve(templatesUriBase.substring(FILE_PREFIX.length()));
+            String templatesUri = templatesUriBase.substring(FILE_PREFIX.length());
+            //windows uri
+            if (templatesUri.contains(":")) {
+                templatesUri = templatesUri.substring(3);
+                templatesUri = templatesUri.replaceAll("/","\\");
+            }
+            final Path resolvedTemplatesDir = basePath.resolve(templatesUri);
             try {
                 return new MultiTemplateLoader( //
                         new TemplateLoader[] { //
@dufoli dufoli changed the title creation of creation of extension on windows failed Aug 9, 2021
@ppalaga
Copy link
Contributor

ppalaga commented Aug 10, 2021

Thanks for the report, @dufoli! Could you please try to remove the three slashes around here https://github.com/apache/camel-quarkus/blob/main/pom.xml#L543 as a quick workaround? I'll have a Windows VM available in ~2 weeks and I'd work on a permanent fix then.

@dufoli
Copy link
Contributor Author

dufoli commented Aug 10, 2021

IT works!
does it work on linux too ?

D:\src\camel-quarkus>mvn cq:create -N -Dcq.artifactIdBase=cxf
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< org.apache.camel.quarkus:camel-quarkus >---------------
[INFO] Building Camel Quarkus 2.2.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- cq-maven-plugin:0.38.0:create (default-cli) @ camel-quarkus ---
[INFO] Generating D:\src\camel-quarkus\extensions\cxf\pom.xml
[INFO] Generating D:\src\camel-quarkus\extensions\cxf\runtime\pom.xml
[INFO] Generating D:\src\camel-quarkus\extensions\cxf\runtime\src\main\resources\META-INF\quarkus-extension.yaml
[INFO] Generating D:\src\camel-quarkus\extensions\cxf\deployment\pom.xml
[INFO] Generating D:\src\camel-quarkus\extensions\cxf\deployment\src\main\java\org\apache\camel\quarkus\component\cxf\deployment\CxfProcessor.java
[INFO] Adding module [cxf] to [D:\src\camel-quarkus\extensions\pom.xml]
[INFO] Adding [camel-quarkus-cxf] to dependencyManagement in [D:\src\camel-quarkus\poms\bom\pom.xml]
[INFO] Adding [camel-quarkus-cxf-deployment] to dependencyManagement in [D:\src\camel-quarkus\poms\bom\pom.xml]
[INFO] Adding [org.apache.camel:camel-cxf:${camel.version}] to dependencyManagement in [D:\src\camel-quarkus\poms\bom\pom.xml]
[INFO] Adding module [cxf] to [D:\src\camel-quarkus\integration-tests\pom.xml]
[INFO] Generating D:\src\camel-quarkus\integration-tests\cxf\pom.xml
[INFO] Generating D:\src\camel-quarkus\integration-tests\cxf\src\main\resources\application.properties
[INFO] Generating D:\src\camel-quarkus\integration-tests\cxf\src\main\java\org\apache\camel\quarkus\component\cxf\it\CxfResource.java
[INFO] Generating D:\src\camel-quarkus\integration-tests\cxf\src\test\java\org\apache\camel\quarkus\component\cxf\it\CxfTest.java
[INFO] Generating D:\src\camel-quarkus\integration-tests\cxf\src\test\java\org\apache\camel\quarkus\component\cxf\it\CxfIT.java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.147 s
[INFO] Finished at: 2021-08-10T21:49:15+02:00
[INFO] ------------------------------------------------------------------------

@ppalaga
Copy link
Contributor

ppalaga commented Aug 10, 2021

does it work on linux too ?

Yes, it does. Could you please submit it as a separate fix for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants