cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf-xjc-utils git commit: [CXFXJC-8] More work on using windows style paths
Date Mon, 10 Nov 2014 18:23:56 GMT
Repository: cxf-xjc-utils
Updated Branches:
  refs/heads/master f942adb8d -> 8f06f45b2


[CXFXJC-8] More work on using windows style paths


Project: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/commit/8f06f45b
Tree: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/tree/8f06f45b
Diff: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/diff/8f06f45b

Branch: refs/heads/master
Commit: 8f06f45b281ede221a2fc8ffb910713c61a31e12
Parents: f942adb
Author: Daniel Kulp <dkulp@apache.org>
Authored: Mon Nov 10 13:23:25 2014 -0500
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Nov 10 13:23:25 2014 -0500

----------------------------------------------------------------------
 cxf-xjc-plugin/pom.xml                          | 35 ++++++++++++++++++++
 .../cxf/maven_plugin/XSDToJavaRunner.java       | 30 +++++++++++++++--
 2 files changed, 62 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/blob/8f06f45b/cxf-xjc-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/cxf-xjc-plugin/pom.xml b/cxf-xjc-plugin/pom.xml
index 07f2fce..729a1d3 100644
--- a/cxf-xjc-plugin/pom.xml
+++ b/cxf-xjc-plugin/pom.xml
@@ -127,5 +127,40 @@
                 </executions>
             </plugin>
         </plugins>
+        <pluginManagement>
+        	<plugins>
+        		<!--This plugin's configuration is used to store Eclipse m2e settings only.
It has no influence on the Maven build itself.-->
+        		<plugin>
+        			<groupId>org.eclipse.m2e</groupId>
+        			<artifactId>lifecycle-mapping</artifactId>
+        			<version>1.0.0</version>
+        			<configuration>
+        				<lifecycleMappingMetadata>
+        					<pluginExecutions>
+        						<pluginExecution>
+        							<pluginExecutionFilter>
+        								<groupId>
+        									org.apache.maven.plugins
+        								</groupId>
+        								<artifactId>
+        									maven-plugin-plugin
+        								</artifactId>
+        								<versionRange>
+        									[3.2,)
+        								</versionRange>
+        								<goals>
+        									<goal>descriptor</goal>
+        								</goals>
+        							</pluginExecutionFilter>
+        							<action>
+        								<ignore></ignore>
+        							</action>
+        						</pluginExecution>
+        					</pluginExecutions>
+        				</lifecycleMappingMetadata>
+        			</configuration>
+        		</plugin>
+        	</plugins>
+        </pluginManagement>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/blob/8f06f45b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
----------------------------------------------------------------------
diff --git a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
index 3130428..be35577 100644
--- a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
+++ b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
@@ -72,6 +72,16 @@ public class XSDToJavaRunner {
     final File xsdFile;
     
     
+    private static File getFile(String s) throws Exception {
+        File f = new File(s);
+        if (f.exists()) {
+            return f;
+        }
+        URI uri = new URI(s);
+        f = new File(uri);
+        return f;
+    }
+    
     public XSDToJavaRunner(String[] args, XJCErrorListener listener,
                            File file, List<String> cp) {
         this.args = args;
@@ -82,7 +92,8 @@ public class XSDToJavaRunner {
     public int run() throws Exception {
         List<URL> urls = new ArrayList<URL>();
         for (String s : cpList) {
-            urls.add(new File(s).toURI().toURL());
+            File file = getFile(s);
+            urls.add(file.toURI().toURL());
         }
         final ClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()]),

                                                       this.getClass().getClassLoader());
@@ -195,9 +206,12 @@ public class XSDToJavaRunner {
             return (Model)getModelLoaderClass()
                 .getMethod("load", Options.class, JCodeModel.class, ErrorReceiver.class)
                 .invoke(null, opt, new JCodeModel(), listener);
+        } catch (Exception e) {
+            listener.error("Failed to create model", e);
         } catch (Throwable e) {
-            return null;
+            e.printStackTrace();
         }
+        return null;
     }
     
     public static class CustomizedLogic extends XMLSchemaInternalizationLogic {
@@ -319,11 +333,21 @@ public class XSDToJavaRunner {
 
     public static void main(String[] args) throws Exception {
         List<String> cplist = new ArrayList<String>();
+        for (int x = 0; x < args.length; x++) {
+            if ("-classpath".equals(args[x])) {
+                cplist.add(args[x + 1]);
+                File file = getFile(args[x + 1]);
+                if (file.exists()) {
+                    args[x + 1] = file.getAbsolutePath();
+                }
+                x++;
+            }
+        }
 
         BuildContext context = new XJCBuildContext();
         XJCErrorListener listener = new XJCErrorListener(context);
         
-        File outputFile = new File(args[args.length - 1]);
+        File outputFile = getFile(args[args.length - 1]);
         int i = new XSDToJavaRunner(args, listener, outputFile, cplist).run();
         System.exit(i);
     }


Mime
View raw message