scalatest / scalatest-maven-plugin

ScalaTest Maven Plugin
Apache License 2.0
34 stars 61 forks source link

how to set `<environmentVariables>` #84

Closed xhudik closed 3 years ago

xhudik commented 3 years ago

Hi there, I'm trying to include some environmental variables into my test:

<environmentVariables>DATADIR="../DDDDD"</environmentVariables>

However, I'm getting:

Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of
mojo org.scalatest:scalatest-maven-plugin:2.0.2:test for parameter environmentVariables: 
Cannot assign configuration entry 'environmentVariables' with value 'DATADIR="../DDDDD"' of type java.lang.String to 
property of type java.util.Map

can you please help me how to add correctly <environmentVariables>, or systemProperties? Or a link to documentation (i could find any example)

andreoss commented 3 years ago

@xhudik Variable name should be a tag, like that

        <environmentVariables>
            <FOO>bar</FOO>
        </environmentVariables>
xhudik commented 3 years ago

indeed - it is working! great thank you @andreoss . Just out of curiosity - where did you find how to use it? (i couldnt google it anywhere)

andreoss commented 3 years ago

@xhudik It's being parsed to Map here https://github.com/scalatest/scalatest-maven-plugin/blob/master/src/main/java/org/scalatest/tools/maven/AbstractScalaTestMojo.java#L266. Usually it means xml like above.