I followed How to set env variables for maven to run test correctly? and configured my pom like this :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<systemPropertyVariables>
<SENDGRID_USERNAME>username</SENDGRID_USERNAME>
<SENDGRID_PASSWORD>password</SENDGRID_PASSWORD>
</systemPropertyVariables>
</configuration>
</plugin>
when i run mvn test
command, it is giving the following error,
Error in custom provider, java.lang.IllegalStateException: SENDGRID_PASSWORD env variable must be set.
What am i doing wrong ?
When I was doing research to find the answer, I found out the following : ProcessBuilder can be used set env for processes spawned with it. I dont know whether ProcessBuilder helps in my case as I am not spawning any processes. My project is maven project and i run test with mvn test command.
Can any body explains me how to set env for situations like this (i.e., maven + junit )
I am able to set the properties
but the problem is how to set environment variable
as my program is expecting the env variable.