cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1080383 - /cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Date Thu, 10 Mar 2011 22:48:40 GMT
Author: dkulp
Date: Thu Mar 10 22:48:40 2011
New Revision: 1080383

URL: http://svn.apache.org/viewvc?rev=1080383&view=rev
Log:
Try to deal with Windows spaces in directories issue

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=1080383&r1=1080382&r2=1080383&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 Mar 10 22:48:40 2011
@@ -441,20 +441,19 @@ public class WSDL2JavaMojo extends Abstr
         URL url = getClass().getResource(getClass().getSimpleName() + ".class");
         
         try {
-            URI uri = url.toURI();
-            if ("jar".equals(uri.getScheme())) {
-                String s = uri.getSchemeSpecificPart();
+            if ("jar".equals(url.getProtocol())) {
+                String s = url.getPath();
                 if (s.contains("!")) {
                     s = s.substring(0, s.indexOf('!'));
-                    uri = new URI(s);
+                    url = new URL(s);
                 }
             }
+            URI uri = new URI(url.getProtocol(), null, url.getPath(), null, null);
             if (uri.getSchemeSpecificPart().endsWith(".class")) {
                 String s = uri.toString();
                 s = s.substring(0, s.length() - 6 - getClass().getName().length());
                 uri = new URI(s);
             }
-            
             File file = new File(uri);
             if (file.exists()) {
                 artifactsPath.add(file.toURI());
@@ -626,9 +625,11 @@ public class WSDL2JavaMojo extends Abstr
         }
 
         cmd.createArg().setLine(additionalJvmArgs);
-
+        
+        File file = null;
         try {
-            File file = FileUtils.createTempFile("cxf-codegen", ".jar");
+            //file = new File("/tmp/test.jar"); 
+            file = FileUtils.createTempFile("cxf-codegen", ".jar");
 
             JarArchiver jar = new JarArchiver();
             jar.setDestFile(file.getAbsoluteFile());
@@ -636,7 +637,11 @@ public class WSDL2JavaMojo extends Abstr
             Manifest manifest = new Manifest();
             Attribute attr = new Attribute();
             attr.setName("Class-Path");
-            attr.setValue(StringUtils.join(classPath.iterator(), " "));
+            StringBuilder b = new StringBuilder(8000);
+            for (URI cp : classPath) {
+                b.append(cp.toURL().toExternalForm()).append(' ');
+            }
+            attr.setValue(b.toString());
             manifest.getMainSection().addConfiguredAttribute(attr);
             
             attr = new Attribute();
@@ -688,6 +693,9 @@ public class WSDL2JavaMojo extends Abstr
             throw new MojoExecutionException(msg.toString());
         }
 
+        if (file != null) {
+            file.delete();
+        }
         if (StringUtils.isNotEmpty(err.getOutput()) && err.getOutput().contains("WSDL2Java
Error")) {
             StringBuffer msg = new StringBuffer();
             msg.append(err.getOutput());



Mime
View raw message