Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Java compiler receives broken classpath when invoked within Spring Boot jar application #28

@villuv

Description

@villuv

Original problem description, reproduction code and discussion is here: querydsl/querydsl#1407

Basically,

If Spring Boot application gets run with java -jar, classloader returns "nested jar" classpath entries, like

0 = {URL@2237} "jar:file:/Users/villuv/src/misc/springboot-querydsl-bug/target/springboot-querydsl-bug-1.0-SNAPSHOT.jar!/"
1 = {URL@2238} "jar:file:/Users/villuv/src/misc/springboot-querydsl-bug/target/springboot-querydsl-bug-1.0-SNAPSHOT.jar!/lib/spring-boot-starter-1.2.4.RELEASE.jar!/"
...

Now, this here https://github.com/querydsl/codegen/blob/master/src/main/java/com/mysema/codegen/SimpleCompiler.java#L69 deals with composing the classpath parameter for the compiler. And it seems to be unable to handle those "deep jar URLs" correctly. For example, classpath entry from classloader:

jar:file:/Users/villuv/src/misc/springboot-querydsl-bug/target/springboot-querydsl-bug-1.0-SNAPSHOT.jar!/

decodedPath becomes

file:/Users/villuv/src/misc/springboot-querydsl-bug/target/springboot-querydsl-bug-1.0-SNAPSHOT.jar!/

And following thing gets added to paths

/Users/villuv/src/misc/springboot-querydsl-bug/target/file:/Users/villuv/src/misc/springboot-querydsl-bug/target/springboot-querydsl-bug-1.0-SNAPSHOT.jar!

Notice that it keeps the file: scheme name in the middle of it and also prepends a full path even though the URL already is a full path.
Next up, pathJoiner will concatenate all these entries together, using : as path separator character. This means, classpath string that gets given to the compiler can't be decoded correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions