My application needs to know the path to a directory where it can store its data. I tried to set a Java system property and use that variable as a placeholder in my Spring XML.

In Eclipse I added that property to the environment of my run configuration and it works just fine. Spring resolves *${dataDir}* to the correct path.

But when I test the application using Maven2 (*mvn test -DdataDir=c:/data*), Spring complains that it can't resolve the placeholder.

My Spring XML looks like this:

```
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"

 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/tx
      http://www.springframework.org/schema/tx/spring-tx.xsd">

 <!-- Allows me to use system properties in this file -->
 <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />

 <bean id="xmlConfiguration" class="org.apache.commons.configuration.XMLConfiguration">
  <constructor-arg index="0">
   <value>${dataDir}/conf/config.xml</value>
  </constructor-arg>
 </bean>
</beans>

```

Why isn't that system property passed to Spring? What am I doing wrong? Thanks for any suggestions!

**EDIT:** Of course, you're right: ${baseDir} should be ${dataDir}. But that was just a typo in this question, not in the real code.

I tried *MAVEN\_OPTS* before but it doesn't work either...