You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
quarkus-maven-plugin no longer utilizes profile properties after a file was written to ${project.build.outputDirectory}/application-develop.properties
#43366
Open
jg-cantaa opened this issue
Sep 18, 2024
· 3 comments
In CI we run maven with the profiles flag "-P azureDevops,$(branchName)". This configuration passes CI and deploys, but at runtime Quarkus complains that the Datasource is not configured:
Caused by: io.quarkus.runtime.configuration.ConfigurationException: Unable to find datasource '<default>' for persistence unit '<default>': Datasource '<default>' is not configured. To solve this, configure datasource '<default>'. Refer to https://quarkus.io/guides/datasource for guidance.
This is somewhat expected as quarkus cannot read the properties from the pom. As a solution to this I have found the properties-maven-plugin from org.codehaus.mojo. Utilizing their plugin like this:
Which I tested locally to produce an application-develop.properties in the target folder. Since quarkus uses the develop profile it should then load the values from there.
Expected behavior
I expected quarkus to not have a problem with this plugin, as it just writes properties to a file in the target folder.
Actual behavior
Once the plugin is added, quarkus fails with the message:
[ERROR] Caused by: com.google.cloud.tools.jib.api.RegistryAuthenticationFailedException: Failed to authenticate with registry registry-1.docker.io/agent/mbcs-search because: 401 Unauthorized
[ERROR] GET https://auth.docker.io/token?service=registry.docker.io&scope=repository:agent/mbcs-search:pull,push
[ERROR] {"details":"incorrect username or password"}
This indicates to me that it has problems with the properties set in the profile once the plugin is enabled. Without the plugin it works fine.
Describe the bug
My original goal is to specify properties at build-time. (e.g. specifying quarkus.datasource.jdbc.url at build-time in CI)
I have a POM file with several profiles like this:
In CI we run maven with the profiles flag "-P azureDevops,$(branchName)". This configuration passes CI and deploys, but at runtime Quarkus complains that the Datasource is not configured:
This is somewhat expected as quarkus cannot read the properties from the pom. As a solution to this I have found the properties-maven-plugin from org.codehaus.mojo. Utilizing their plugin like this:
Which I tested locally to produce an application-develop.properties in the target folder. Since quarkus uses the develop profile it should then load the values from there.
Expected behavior
I expected quarkus to not have a problem with this plugin, as it just writes properties to a file in the target folder.
Actual behavior
Once the plugin is added, quarkus fails with the message:
This indicates to me that it has problems with the properties set in the profile once the plugin is enabled.
Without the plugin it works fine.
I have even looked at the source of the plugin (https://github.com/mojohaus/properties-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/properties/WriteActiveProfileProperties.java) to see if that messes with the properties, but I could not find a reason.
Once I tried to write the property file to ${project.build.outputDirectory}/test/test.properties
it passed CI again.
How to Reproduce?
No response
Output of
uname -a
orver
Output of
java -version
No response
Quarkus version or git rev
<quarkus.platform.version>3.7.4</quarkus.platform.version>
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /home/jakobgerhardt/.m2/wrapper/dists/apache-maven-3.9.6-bin/3311e1d4/apache-maven-3.9.6 Java version: 11.0.23, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: de_DE, platform encoding: UTF-8 OS name: "linux", version: "6.9.3-76060903-generic", arch: "amd64", family: "unix"
Additional information
I tried running this plugin in a different phase, but to no avail.
The text was updated successfully, but these errors were encountered: