cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r694417 - /cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Date Thu, 11 Sep 2008 18:50:36 GMT
Author: dkulp
Date: Thu Sep 11 11:50:36 2008
New Revision: 694417

URL: http://svn.apache.org/viewvc?rev=694417&view=rev
Log:
[CXF-1794] Fix problem with wsdlOptions not being applied correctly

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=694417&r1=694416&r2=694417&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
Thu Sep 11 11:50:36 2008
@@ -132,6 +132,47 @@
         return options;
     }
     
+    private void mergeOptions(List<WsdlOption> options) {
+        File outputDirFile = testSourceRoot == null ? sourceRoot : testSourceRoot;
+        for (WsdlOption o : wsdlOptions) {
+            if (o.getOutputDir() == null) {
+                o.setOutputDir(outputDirFile);
+            }
+            
+            File file = new File(o.getWsdl());
+            if (!file.exists()) {
+                file = new File(project.getBasedir(), o.getWsdl());
+            }
+            if (file.exists()) {
+                file = file.getAbsoluteFile();
+                for (WsdlOption o2 : options) {
+                    File file2 = null;
+                    try {
+                        URI uri = new URI(o2.getWsdl());
+                        if (uri.isAbsolute()) {
+                            file2 = new File(uri);
+                        }
+                    } catch (Exception e) {
+                        //ignore
+                    }
+                    if (file2 == null || !file2.exists()) {
+                        file2 = new File(o2.getWsdl());
+                    }
+                    if (file2 == null || !file2.exists()) {
+                        file2 = new File(project.getBasedir(), o2.getWsdl());
+                    }
+                    if (file2.exists() 
+                        && file2.getAbsoluteFile().equals(file)) {
+                        o.getExtraargs().addAll(0, o2.getExtraargs());
+                        options.remove(o2);
+                        break;
+                    }
+                }
+            }
+            options.add(0, o);
+        }        
+    }
+    
     public void execute() throws MojoExecutionException {
         if (includes == null) {
             includes = new String[] {"*.wsdl"};
@@ -150,26 +191,7 @@
         }
 
         if (wsdlOptions != null) {
-            File outputDirFile = testSourceRoot == null ? sourceRoot : testSourceRoot;
-            for (WsdlOption o : wsdlOptions) {
-                if (o.getOutputDir() == null) {
-                    o.setOutputDir(outputDirFile);
-                }
-                
-                File file = new File(project.getBasedir(), o.getWsdl());                
-                if (file.exists()) {
-                    for (WsdlOption o2 : options) {
-                        File file2 = new File(o2.getWsdl());
-                        if (file2.exists() 
-                            && file2.equals(file)) {
-                            o.getExtraargs().addAll(0, o2.getExtraargs());
-                            options.remove(o2);
-                            break;
-                        }
-                    }
-                }
-                options.add(o);
-            }
+            mergeOptions(options);
         }
         wsdlOptions = options.toArray(new WsdlOption[options.size()]);
 



Mime
View raw message