Search code examples
javajunitmavenjvm-arguments

maven test behind proxy (squid)


I'm having a problem with Maven behind a squid proxy server.

I have a module of my system that depends external communication with a remote webservice.

I have my maven proxy configurations under ~/.m2/settings.xml, but apparently, these information are been used just for dependencies downloads.

When I run 'mvn test', these configurations aren't used on command line execution call. This is the instruction echoed on console:

${JAVA_HOME}/bin/java -jar /tmp/surefirebooter4156656684210940660.jar /tmp/surefire2646147996861949548tmp /tmp/surefire3498083351425809633tmp

There's a way to pass arguments to JVM during tests and other maven method executions?


Solution

  • To fix some arguments on pom.xml, we can configure -DforkMode=never directly on surefire plugin configuration. i.e.

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.5</version>
      <configuration>
        <argLine>-DforkMode=never</argLine>
      </configuration>
    </plugin>
    

    The solution based on -DforkMode was suggested by this post, referenced by @johan-sjoberg on comments posted here