You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2011/05/28 12:11:55 UTC

svn commit: r1128586 - in /cxf/branches/2.3.x-fixes: ./ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Author: ffang
Date: Sat May 28 10:11:55 2011
New Revision: 1128586

URL: http://svn.apache.org/viewvc?rev=1128586&view=rev
Log:
Merged revisions 1128585 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1128585 | ffang | 2011-05-28 18:02:57 +0800 (六, 28  5 2011) | 1 line
  
  [CXF-3547]code-gen-plugin should take advantage of maven proxy setting
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=1128586&r1=1128585&r2=1128586&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java (original)
+++ cxf/branches/2.3.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java Sat May 28 10:11:55 2011
@@ -43,6 +43,7 @@ import org.apache.maven.plugin.AbstractM
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectUtils;
+import org.apache.maven.settings.Proxy;
 
 /**
  * @goal wsdl2java
@@ -333,6 +334,26 @@ public class WSDL2JavaMojo extends Abstr
         }
     }
 
+    private void configureProxyServerSettings() throws MojoExecutionException {
+
+        Proxy proxy = mavenSession.getSettings().getActiveProxy();
+
+        if (proxy != null) {
+
+            getLog().info("Using proxy server configured in maven.");
+
+            if (proxy.getHost() == null) {
+                throw new MojoExecutionException("Proxy in settings.xml has no host");
+            } else {
+                System.setProperty("proxySet", "true");
+                System.setProperty("proxyHost", proxy.getHost());
+                System.setProperty("proxyPort", String.valueOf(proxy.getPort()));
+            }
+
+
+        }
+    }
+
     public void execute() throws MojoExecutionException {
         if (includes == null) {
             includes = new String[] {
@@ -344,6 +365,8 @@ public class WSDL2JavaMojo extends Abstr
         classesDir.mkdirs();
         markerDirectory.mkdirs();
 
+        configureProxyServerSettings();
+
         List<WsdlOption> effectiveWsdlOptions = createWsdlOptionsFromScansAndExplicitWsdlOptions();
 
         if (effectiveWsdlOptions.size() == 0) {