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 informat开发者_开发技巧ion 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?
Perhaps this can be of interest to you: How do I configure proxy settings for Java. Alternatively you can try these startup parameters:
-Dhttp.proxyHost=url
-Dhttp.proxyPort=port
-Dhttp.proxyUser=user
-Dhttp.proxyPassword=pass
[EDIT]
These properties can also be set in MAVEN_OPTS
. This post describes how this would work for the test-profile.
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
精彩评论