]> source.dussan.org Git - vaadin-framework.git/commitdiff
Only ignore NoClassDefFoundError if SmartSprites is missing (#9943) 14/114/1
authorLeif Åstrand <leif@vaadin.com>
Thu, 11 Oct 2012 15:17:41 +0000 (18:17 +0300)
committerLeif Åstrand <leif@vaadin.com>
Thu, 11 Oct 2012 15:17:41 +0000 (18:17 +0300)
Change-Id: I50f33a3bbd648555bc59b8591bc84f8723a4eff4

theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java

index 90e3faf10ef23f42fff66afdc8c300abe397b6b8..47c519d09e23fdf986d0e95cf988db47abf16917 100644 (file)
@@ -105,19 +105,22 @@ public class CompileTheme {
     private static void createSprites(String themeFolder, String themeName)
             throws FileNotFoundException, IOException {
         try {
-            String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
-                    "--css-file-suffix", "-sprite", "--css-file-encoding",
-                    "UTF-8", "--root-dir-path",
-                    themeFolder + File.separator + themeName, "--log-level",
-                    "WARN" };
-
-            org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
-            System.out.println("Generated sprites");
-
+            // Try loading the class separately from using it to avoid
+            // hiding other classpath issues
+            Class<?> smartSpritesClass = org.carrot2.labs.smartsprites.SmartSprites.class;
         } catch (NoClassDefFoundError e) {
             System.err
                     .println("Could not find smartsprites. No sprites were generated. The theme should still work.");
+            return;
         }
 
+        String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
+                "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8",
+                "--root-dir-path", themeFolder + File.separator + themeName,
+                "--log-level", "WARN" };
+
+        org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
+        System.out.println("Generated sprites");
+
     }
 }