How can I set active spring profile o tomcat maven plugin? I want to get active profiles in runtime from Environment, but I' always getting empty array.
I tried to add this systemProperties in plugin configuration in pom.xml:
<JAVA_OPTS>-Dspring.profiles.active=local</JAVA_OPTS>
or
<name>spring.profiles.active</name>
<value>locale</value>
I try to add this in context.xml:
<environment name="spring.profiles.active" value="local" type="java.lang.String" override="false"/>
But still getting no active profile...
My env: Java 6, tomcat7-maven-plugin version 2.2, Netbeans 8.0.2, Spring 3.1.1.RELEASE.
My pom.xml tomcat plugin looks this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- http port -->
<port>8084</port>
<contextFile>${basedir}/src/main/resources-local/context.xml</contextFile>
<systemProperties>
<JAVA_OPTS>-Dspring.profiles.active=local</JAVA_OPTS>
</systemProperties>
</configuration>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>run-war</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<dependencies>
Tomcat 7 Documentation shows a different syntax for System Properties like the one below. So try doing it this way:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<systemProperties>
<example.value.1>alpha</example.value.1>
<example.value.2>beta</example.value.2>
</systemProperties>
</configuration>
</plugin>