• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Maven: Anyone know how to auto-include this option when I'm running tests?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks, - Dave
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,

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!

Marco
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

All the best, - Dave
 
Marco Ehrentreich
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...

Marco
 
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic