helidon-io / helidon-build-tools

Build tools for the Helidon Project
https://helidon.io
Apache License 2.0
35 stars 34 forks source link

CDS archive specific configuration #1039

Open romain-grecourt opened 4 months ago

romain-grecourt commented 4 months ago

Provide CDS specific parameters:


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.

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.

Ideally you'd have the relative path as .., E.g.

|- config/prod.yaml
|- web/
|- helidon-quickstart-se-ri