I am trying to set some system environment variables through maven, based on profiles. So my pom code is
<profile>
<id>dev</id>
<activation>
<property>
<name>com.xxx.profile</name>
<value>dev</value>
</property>
</activation>
<properties>
<db-url>jdbc:postgresql://abc</db-url>
<db-username>xxx</db-username>
<db-pwd>yy</db-pwd>
</properties>
</profile>
So when I build the project, I do mvn clean install -Dcom.xxx.profile=dev
In the code, I have
String urlDB = System.getProperty("db-url");
String username = System.getProperty("db-username");
String password = System.getProperty("db-pwd");
But when I run it, all these variables are null.
System.getProperty("com.xxx.profile") does give the right answer....
Ideas?