helidon:jlink-image requires the working directory to be the -jri directory, this is an issue when the application code relies on the working directory to be the project directory.
E.g.
Using config files relative the project directory
Using static content directory as path (not resource) relative to the project directory
When building the CDS archive, the application is started with the -jri directory as the working directory, thus the relative paths are broken.
The application can work-around it by using configuration to control the static path.
E.g.
Path web = config.get("app.static.path")
.as(Path.class)
.orElseGet(() -> Paths.get("web"));
However this requires passing -Dapp.static.path="../../web" as a JVM option as part of the CDS archive start.
Currently the only way to do this is by using: jlink.image.defaultJvmOptions, but this also hard-codes it as a default for the application.
Ideally we'd have ways to have different values for the CDS archive startup and the actual hard-coded default.
During the build the JRI directory is target/helidon-quickstart-se-ri/ thus the relative path to the project directory is ../.. which is not a nice default value.
Provide CDS specific parameters:
cdsJvmOptions
cdsArgs
cdsDebugOptions
helidon:jlink-image
requires the working directory to be the-jri
directory, this is an issue when the application code relies on the working directory to be the project directory.E.g.
When building the CDS archive, the application is started with the
-jri
directory as the working directory, thus the relative paths are broken.The application can work-around it by using configuration to control the static path. E.g.
However this requires passing
-Dapp.static.path="../../web"
as a JVM option as part of the CDS archive start.Currently the only way to do this is by using:
jlink.image.defaultJvmOptions
, but this also hard-codes it as a default for the application.Ideally we'd have ways to have different values for the CDS archive startup and the actual hard-coded default.
During the build the JRI directory is
target/helidon-quickstart-se-ri/
thus the relative path to the project directory is../..
which is not a nice default value.Ideally you'd have the relative path as
..
, E.g.