Quarkus profiles build & runtime questions

390 views
Skip to first unread message

David Hoffer

unread,
Apr 5, 2021, 3:11:51 PM4/5/21
to Quarkus Development mailing list
We have added a couple of profiles to our application.yml file that specify different persistent unit configurations.

I have a few questions how this is supposed to work.

1.  I have found that I have to specify one profile at build time else the build will fail because it can't match the beans being injected via @PersistenceUnit so I do the following at build time.

mvn clean install -Dquarkus.profile=dataWarehouseA

2. How can I set this as the default profile for the build so we don't have to pass it on the command line?  Can this be configured via quarkus-maven-plugin's configuration?

3. But now at runtime I need to be able to select a different profile so I run like this:

-jar ./target/app-quarkus-runner.jar -Dquarkus.profile=dataWarehouseB

However Quarkus is always using dataWarehouseA, how do I configure it to use dataWarehouseB at runtime?

-Dave

David Hoffer

unread,
Apr 5, 2021, 7:00:15 PM4/5/21
to Quarkus Development mailing list
My bad on #3, I had to put -Dquarkus.profile=dataWarehouseB prior to the jar name not after.  But need help on #2 still.

-Dave

clement escoffier

unread,
Apr 6, 2021, 2:30:16 AM4/6/21
to dhof...@gmail.com, Quarkus Development mailing list
Hello, 

About #2, did you try:

/mvnw package -Dquarkus.profile=dataWarehouseA

That set the default profile in the application. It can still be set in the command line. 

Clement

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/a3b898db-a4ee-4319-bb5f-4029597d7af1n%40googlegroups.com.

David Hoffer

unread,
Apr 6, 2021, 10:09:40 AM4/6/21
to Quarkus Development mailing list
Regarding #2 yes that is what we are currently doing but I need to configure things so that Quarkus profile is set by default.  I don't want every developer and every CI build to have to change to include -Dquarkus.profile=dataWarehouseA.

How can I set this as a default?

I read that Quarkus supports setting the profile via .env file?  But I can't seem to understand how that works (takes effect).

Can I set the build time profile in the maven plugin?  That would seem like a natural place to do this.

-Dave

Alexey Loubyansky

unread,
Apr 6, 2021, 10:24:33 AM4/6/21
to David Hoffer, Quarkus Development mailing list
On Tue, Apr 6, 2021 at 4:09 PM David Hoffer <dhof...@gmail.com> wrote:
Regarding #2 yes that is what we are currently doing but I need to configure things so that Quarkus profile is set by default.  I don't want every developer and every CI build to have to change to include -Dquarkus.profile=dataWarehouseA.

How can I set this as a default?

I read that Quarkus supports setting the profile via .env file?  But I can't seem to understand how that works (takes effect).

Yes, you should be able to set it with QUARKUS_PROFILE.

Can I set the build time profile in the maven plugin?  That would seem like a natural place to do this.

Yes, in 1.13.0.Final quarkus.profile property in your pom.xml.
 

David Hoffer

unread,
Apr 6, 2021, 11:48:39 AM4/6/21
to Quarkus Development mailing list
Yes I can confirm that in 1.13.0.Final setting quarkus.profile property in our pom did set the default profile and then I can override at runtime.

-Dave

David Hoffer

unread,
Apr 6, 2021, 6:51:33 PM4/6/21
to Quarkus Development mailing list
Unfortunately I have bad news to report.  

Although at runtime I can set the quarkus.profile property to a different value and ProfileManager.getActiveProfile() reports that change correctly, it does NOT actually read/apply the properties specified by the runtime quarkus.profile.  This must be a Quarkus bug?

-Dave

Reply all
Reply to author
Forward
0 new messages