I setup a basic maven Java project in Netbeans. I made a new property in the POM.xml
file and tried to read it in my code. But, I keep getting a null instead of the value. What am I doing wrong?
POM.XML:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test</groupId>
<artifactId>Test</artifactId>
<version>1.0</version>
</parent>
<artifactId>Test</artifactId>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<system>ABC</system>
</properties>
</project>
Code :
package com.test.Test;
public class Test {
public static void main(String[] args) {
System.out.println("Creating connection to " + System.getProperty("system") + "...");
}
}