d-man
d-man

Reputation: 58063

Java maven Junit read systemproperties variable to load property file

Java Maven Spring Junit with webapplication

I am using following code to load property file into spring context placer holder.

<context:property-placeholder location="file:${RESOURCE_PATH}/jdbc.properties" />

in eclipse Junit run time configuration i have defined "RESOURCE_PATH" so it runs fine when i execute my junit tests from GUI but when i run from maven they fail.

Can we define variable and pass in pom file at run time ?

Upvotes: 0

Views: 490

Answers (1)

AlexR
AlexR

Reputation: 115328

You should either supply the property RESOURCE_PATH using -D switch when running maven or put it into pom.xml into section <properties>; something like this:

<properties>
    <RESOURCE_PATH>put your path here</RESOURCE_PATH>
</properties>

Upvotes: 1

Related Questions