0

Suppose I have some Maven profiles and some Spring profiles. I would like to manage all my profiles in an application-(spring-profile).yaml. Is it possible to activate a Maven Profile from a Spring Profile? I read about activating Spring profiles from Maven, but I have not found anything about activating Maven profiles from Spring.

Example

pom.xml

<profiles>
        <profile>
            <id>integration-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                ... (in my case some Postman Collections)
            </build>
        </profile>
</profiles>

manifest-dev.yaml

spring:
   profiles:
      active: integration-tests, other-spring-profile

The Maven profile integration-tests is activated as a Spring profile in the example. I am looking for a preferably declarative way to activate Maven profiles in the application.yaml files

df21
  • 1
  • 2
  • 1
    You cannot do that. The other way around would work but you cannot activate a maven profile from spring boot. – M. Deinum Nov 11 '21 at 10:58

1 Answers1

0

In application.properties set

spring.profile = ${yourActiveSpringProfile}

You can see something around at How to set spring active profiles with maven profiles

Vy Do
  • 46,709
  • 59
  • 215
  • 313