quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Application.properties string substitution does not work when using gradle variables

Open csh97 opened this issue 1 year ago • 4 comments

Describe the bug

Using Quarkus versions 3.6.5+, when using a gradle variable, set in gradle.properties, in application.properties the value is not substituted.

For example: I have a variable newRelicVersion set to 8.7.0 in gradle.properties

I am using the quarkus-container-image-jib dependency to build an image. I want to pass in a jvm argument to set javaagent to the path to a new relic agent jar. This path includes the version of the new relic agent and I want to be able to use string interpolation to set the version in the path. E.g.

quarkus.jib.jvm-arguments=-javaagent:lib/main/com.newrelic.agent.java.newrelic-agent-${newRelicVersion:unknown}.jar

Expected behavior

When building an image the variable newRelicVersion used in application.properties should be replaced with the value set in gradle.properties

Actual behavior

When building an image and running a container, I get the following error:

Error opening zip file or JAR manifest missing : lib/main/com.newrelic.agent.java.newrelic-agent-unknown.jar

The variable was not replaced with the value set in gradle.properties, instead it falls back to the default value unknown

If Quarkus version is set to 3.6.4, the value is used and the container builds successfully.

I noticed a similar issue with native builds that was fixed in 3.6.5, not sure if the fix for this issue has caused this? https://github.com/quarkusio/quarkus/issues/33321

How to Reproduce?

Reproducer: https://github.com/csh97/quarkus-gradle-varibale-reproducer - steps in the readme

Output of uname -a or ver

Darwin H777N20TP7 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 arm64

Output of java -version

openjdk 21.0.1 2023-10-17 OpenJDK Runtime Environment GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19) OpenJDK 64-Bit Server VM GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)

Quarkus version or git rev

3.6.5

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.5

Additional information

No response

csh97 avatar Jan 25 '24 10:01 csh97

/cc @geoand (jib), @glefloch, @quarkusio/devtools

quarkus-bot[bot] avatar Jan 25 '24 10:01 quarkus-bot[bot]

cc @radcortez

geoand avatar Jan 25 '24 11:01 geoand

Is this still an issue @radcortez or has it been addressed with the latest changes in SR Config?

geoand avatar Feb 12 '24 15:02 geoand

No. This is an issue specific to Gradle (like many others we have). I'm planning to own the Gradle plugin config, because it is becoming a source of many issues in config, due to how configuration is handled there.

radcortez avatar Feb 14 '24 12:02 radcortez