0

I need to setup some environment variables in my test classes and I don't want to pass them to Maven with -D flag every time. Is there a way to setup these environment variables in pom.xml file only for tests?

I've tried to setup them with System.getenv().put() but without success (java.lang.UnsupportedOperationException)

Michael Pacheco
  • 948
  • 1
  • 17
  • 25
  • 1
    you can specify env variables in pom instead of using -D . this will help you: https://stackoverflow.com/questions/10463077/how-to-refer-environment-variable-in-pom-xml – Adi Ohana Apr 01 '19 at 15:17

1 Answers1

1

Most maven plugins seem to support the configuration element. This should explain what you need Configuring surefire plugin

Terry
  • 911
  • 10
  • 26