I found that you ca access the active profiles via properties:
${project.activeProfiles[0].id}
Unfortunately I do not have any idea which profiles, nor how many will
be active. I tried:
${project.activeProfiles.id}
Hoping that I would get the id of all active profiles running but that
did not work either.
So I think I am still looking at the possibility of appending to
existing property values, but I do not see that this is possible
either.
Any ideas?
Thanks
On Tue, Dec 11, 2012 at 3:38 PM, Billy Newman <[email protected]> wrote:
> I am building a spring application and I would like to activate
> certain spring profiles based on profiles that I have active in my
> build.
>
> To active spring profiles you need the following in your web.xml:
>
> <context-param>
> <param-name>spring.profiles.active</param-name>
> <param-value>profile1,profile2,profile3</param-value>
> </context-param>
>
> The best I could come up with is to use property replacement in maven:
> <context-param>
> <param-name>spring.profiles.active</param-name>
> <param-value>${spring.active.profiles}</param-value>
> </context-param>
>
> This works just great if I set the property
> <properties>
> <spring.active.profiles>profile1,profile2,profile3</spring.active.profiles>
> </properties>
>
> However what I am really after is having multiple maven profiles, and
> for each active profile add a new spring profile.
>
> <profiles>
> <profile>
> <id>profile1</id>
> <spring.active.profiles>profile1</spring.active.profiles>
> </profile>
> <profile>
> <id>profile2</id>
> <spring.active.profiles>profile2</spring.active.profiles>
> </profile>
> <profile>
> <id>profile3</id>
> <spring.active.profiles>profile3</spring.active.profiles>
> </profile>
> </profiles>
>
> So if I activate all the profiles when I build (mvn clean install
> -Pprofile1,profile2,profile3) I would really like a property that
> looked like:
> <spring.active.profiles>profile1,profile2,profile3</spring.active.profiles>.
>
> In the example I gave obviously the one and only property just gets
> overridden not appended to.
>
> Anyone have any other ideas/options on what I might try to build this
> comma separated list for my spring profile?
>
> Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]