System properties can't be resolved in Spring XML using Maven?

This is a known bug in the Surefire plugin 2.4.3. For details, see JIRA issue System properties set on the command line get clobbered Use the previous version, 2.4.2 instead.

This is a known bug in the Surefire plugin 2.4.3. For details, see JIRA issue "System properties set on the command line get clobbered". Use the previous version, 2.4.2 instead: org.apache.maven.

Plugins maven-surefire-plugin 2.4.2.

This is the best solution - embed any required properties in your POM file. This way they are stored with the project so that all team members have access to them (and don't have to set up their env separately), and so they are version-controlled. – John Stauffer Oct 29 '09 at 18:29.

If you look at the mvn script, you can see that all arguments passed via the command line are passed as arguments to the launch class, not as arguments to the JVM. So -D won't work. The quickest workaround is to define the MAVEN_OPTS environment variable, e.g. Set MAVEN_OPTS="-DdataDir=c:/data" and then run mvn test.

I think this is no longer true. The latest addition to the JIRA issue linked in the chosen answer says "system props passed directly into the JVM via MAVEN_OPTS are not forwarded to the tests. " – Patrick Nov 4 '10 at 23:16.

I mean that you pass dataDir, but expect baseDir. Am I wrong?

I think that flicken's answer is the right answer to your question. However, I'd suggest to move the config. Xml file in src/test/resources.

This seems to be a perfect location (in maven's world) and, this way, the file will be available on the classpath (so you won't have to use an absolute path). On top of that, the file will end up in the version control like any other resource of the project which is a good thing. If really you want to keep it outside the project structure, I'd use resources filtering to filter your Spring configuration file and set ${dataDir} at build time.

The file should be stored outside the project because it must not be overwritten when I want to update the application. But keeping it under Version Control is a good point. Have to think about that – Olvagor Nov 3 '09 at 12:18.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions