I have a Maven project and I tried to extract sensitive information from my code using ~/.m2/settings.xml. As far as I can tell from checking with the mvn -X command, the file can be read from.
This is my file:
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<profiles>
<profile>
<activeByDefault>true</activeByDefault>
<id>camera</id>
<properties>
<camera.url>some url</camera.url>
</properties>
</profile>
</profiles>
</settings>
I have tried getting the value from camera.url in my code using pom.xml:
<build>
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<systemPropertyVariables>
<camera.url>${camera.url}</camera.url>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
And then I am trying to retrieve the value in code using System.getProperty("camera.url"), but this returns null.
I can't seem to figure out what I have done wrong.