Michael Pacheco
Michael Pacheco

Reputation: 1164

How to setup environment variables in test scope with Maven?

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)

Upvotes: 0

Views: 1310

Answers (1)

Terry
Terry

Reputation: 927

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

Upvotes: 1

Related Questions