I'm using Maven 1.1 for a Java (1.5) project on Mac 10.5.6. I have a number of unit tests within a sub-folder of my "test" directory. In order to run everything smoothly, I must run a command like below when I cd into my test directory:
maven -Dhttp.nonProxyHosts=localhost test:test
My question is, do you know a file or somewhere I can place the "-Dhttp.nonProxyHosts=localhost" option so I can just run "maven test:test"? When I pass this project on to another developer, I don't want to have to explicitly tell them to include this option.
I'm not really sure if this is what you want, but I'm actually using TestNG for unit tests together with the JMockit framework. This requires a command line option you would usually add on the console just like in your example. I have not tested it but I could imagine that you can use the <argline> tag to define a system property with <argline>-Dhttp.nonProxyHosts=localhost</argline>:
Btw. just in case you don't know: The surefire plugin is usually use by maven to run tests! So it should be the right place to add the said command line options which are only required during the test phase! I hope this helps. I'd like to hear your feedback in any case!
Joined: Jul 02, 2008
Thanks for this reply, Marco. What complicates things is that I'm restricted to an old version of Maven -- 1.1. I was looking at the surefire plugin and it appears to only be available for Maven 2 and higher. Perhaps I'm misunderstanding, but if I'm not, do you know any solution that would be backwards compatible with Maven 1.1?
Sorry Dave, I've only used Maven since 2.x and I've no idea how things work in Maven 1.x...
The only thing I can think of which COULD work even for Maven 1 would be the Maven environment variable which is in your case MAVEN_OPTS if I remember correctly. Depending on your OS, i.e. Linux or Windows, it should be possible to add something like this in UNIX/Linux:
to the environment of the user which runs your Maven project. I'm really not sure but it could work...
subject: Maven: Anyone know how to auto-include this option when I'm running tests?