cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1128585 - /cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Date Sat, 28 May 2011 10:02:57 GMT
Author: ffang
Date: Sat May 28 10:02:57 2011
New Revision: 1128585

URL: http://svn.apache.org/viewvc?rev=1128585&view=rev
Log:
[CXF-3547]code-gen-plugin should take advantage of maven proxy setting

Modified:
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=1128585&r1=1128584&r2=1128585&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Sat May 28 10:02:57 2011
@@ -51,6 +51,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;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.jar.Manifest;
 import org.codehaus.plexus.archiver.jar.Manifest.Attribute;
@@ -380,6 +381,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[] {
@@ -391,6 +412,8 @@ public class WSDL2JavaMojo extends Abstr
         classesDir.mkdirs();
         markerDirectory.mkdirs();
 
+        configureProxyServerSettings();
+
         List<WsdlOption> effectiveWsdlOptions = createWsdlOptionsFromScansAndExplicitWsdlOptions();
 
         if (effectiveWsdlOptions.size() == 0) {



Mime
View raw message