I'm trying to do the following, but in IntelliJ with a TestNG run configuration:
mvn clean install -Dfoo=bar
So, the value for the foo system property should be bar:
System.out.println(System.getProperty("foo"));
======
bar
All potential answers I've googled either tell me to hardcode variables into my pom.xml (which I can't do) or say to "just set it in Edit Configurations..." without showing what a properly set variable looks like. I dug through the IntelliJ manual too.
I tried all the logical names for "foo" in both Run/Debug Configurations/Parameters tab and Run/Debug Configurations/Environment Variables, such as Dfoo and -Dfoo.
Use a Maven configuration instead of a TestNG configuration. You can still run your TestNG tests from the Maven configuration: