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

Native compilation doesn't like space in project directory #1673

Closed
jcordes73 opened this issue Mar 25, 2019 · 5 comments
Closed

Native compilation doesn't like space in project directory #1673

jcordes73 opened this issue Mar 25, 2019 · 5 comments
Labels
kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@jcordes73
Copy link

When creating a project directory with a space in it, native compilation fails, see steps to reproduce below:

mkdir "dir with space"
cd dir\ with\ space/
mvn io.quarkus:quarkus-maven-plugin:0.12.0:create
-DprojectGroupId=quarkus.io
-DprojectArtifactId=space-quickstart
-DprojectVersion=1.0-SNAPSHOT
-DclassName="io.quarkus.SpaceResource"
mvn compile quarkus:dev
mvn package -Pnative

The following fixes the issue:

mv dir\ with\ space/ dir_with_space/

@dmlloyd
Copy link
Member

dmlloyd commented Mar 25, 2019

This seems related to #1402/#1607/#1438/#1030/etc.

@gsmet gsmet added the kind/bug Something isn't working label Mar 25, 2019
@rsvoboda
Copy link
Member

The first error is Error: Class initialization failed: io.quarkus.undertow.runtime.graal.URLResourceSubstitution$ResourceInfo
Caused by: java.io.FileNotFoundException: /Users/rsvoboda/tmp/dir%20with%20space/target/lib/io.smallrye.smallrye-config-1.3.5.jar (No such file or directory) in my case.

I see same error when the root directory is named:

  • app dir ect ory
  • app#dir
  • žluťoučký-kůň
  • app!@#%dir ect ory

For the following cases I have successful run of compilation + dev mode + native build

  • app@dir
  • app(dir)ectory

With app?dir case I don't get through package phase

14:55:46 [INFO] 
14:55:46 [INFO] --- quarkus-maven-plugin:999-SNAPSHOT:build (default) @ space-quickstart ---
14:55:46 [INFO] ------------------------------------------------------------------------
14:55:46 [INFO] BUILD FAILURE
14:55:46 [INFO] ------------------------------------------------------------------------
14:55:46 [INFO] Total time: 7.579 s
14:55:46 [INFO] Finished at: 2019-03-27T14:55:46+01:00
14:55:46 [INFO] ------------------------------------------------------------------------
14:55:46 [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:
  build (default) on project space-quickstart: Failed to build a runnable JAR: 
  Failed to build a runner jar: URI has a query component -> [Help 1]

@dmlloyd
Copy link
Member

dmlloyd commented Mar 27, 2019

Again it's going to be wrong URI handling somewhere.

Here's the rules for class paths:

  • A MANIFEST.MF Class-Path is a list of relative URIs. A relative URI is not a relative directory, it's a URI without a scheme (see the RFC).
    • Additional rule for Windows: Absolute paths of the form C:\foo\bar.jar must have a leading slash when included in a Class-Path, like this: /C:/foo/bar. This happens by default when you use URI#getRawPath as described below. Note that when specifying paths in a CLASSPATH or -classpath, you must not use the leading / before the drive letter!
  • Since it's a space-separated list, the "raw" URI must be used (see the JavaDoc for URI.toAsciiString() as this will URI-encode and UTF-8 encode the whole URI).
  • The JDK forbids usage of URIs that are not in the file scheme. Some JDKs don't allow URIs with any scheme including file. Make sure the URI is relative before encoding it. I think that simply using the raw path will just about always suffice.
  • When emitting URIs, use Path.toUri(). If you're just pulling the raw path, no further conversion is necessary.
  • When decoding URIs back to Path, use Paths.get(URI). Nice and easy.
  • When you need a File, use Path.toFile().

If you are not adhering to these rules, please include copious documentation explaining your rationale!

I'll update all related issues to reference this comment.

@machi1990
Copy link
Member

This seems related to #1402/#1607/#1438/#1030/etc.

Can this issue be closed? Looks like all the related issues have been closed.

@dmlloyd
Copy link
Member

dmlloyd commented Sep 9, 2019

Yes, I think so. Thanks.

@dmlloyd dmlloyd closed this as completed Sep 9, 2019
@gsmet gsmet added the triage/out-of-date This issue/PR is no longer valid or relevant label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

5 participants