Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.5.4, 2.5.5, 2.5.6, 2.5.7
-
None
-
None
-
Moderate
Description
The System.properties -Dhttp.nonProxyHosts=.... is not set during the Mojo executions, but others parameters for http proxy are set ( useProxy, http.proxyHost, http.proxyPort), resulting in inconsistencies .
This is particulary annoying when using plugin cxf-maven-plugin and then another plugin in the same jvm, like jetty:run or failsafe/surefire ...
The bugs occurs for example in mvn jetty:run after, doing a HttpURLConnection, with exception like "407 Proxy authentication required" while trying to access a http resource within the intranet, that should have by-passed the proxy but which is not due to missing -Dhttp.nonProxyHosts. Notice that to reproduce the problem, you must have a very restrictive proxy with authentication (like ntlm), and the bug occurs because credentials user/password are also not set passed from maven to the jvm.
The bug is in cxf-codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
line 332
The following line is missing :
System.setProperty("http.nonProxyHosts", String.valueOf(proxy.getNonProxyHosts()));
Remarks:
1) to avoid side-effects on the current jvm, you could also restore previous value in a try-finally :
String PROP = "http.nonProxyHosts"; // cf also http.proxyHost ..
String requiredPropValue = "localhost|*.mydomain";
String oldPropertyValue = System.getProperty(PROP);
if (!requiredPropValue.equals(oldPropertyValue))
try
{ // *** do work in cxf-plugin *** } finally {
// restore old property value
if (!requiredPropValue.equals(oldPropertyValue))
}
2) You should also use the credentials login/password in case of authenticating proxy...
Attachments
Issue Links
- duplicates
-
CXF-4687 cxf-codegen-plugin breaks mvn deploy when proxy exists
- Closed