1.1 --- a/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Bck2BrswrMojo.java Fri Nov 16 08:12:01 2012 +0100
1.2 +++ b/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Bck2BrswrMojo.java Wed Dec 12 20:35:01 2012 +0100
1.3 @@ -21,7 +21,7 @@
1.4
1.5 import java.io.File;
1.6 import java.io.FileWriter;
1.7 -import java.lang.reflect.Method;
1.8 +import java.io.IOException;
1.9 import java.net.MalformedURLException;
1.10 import java.net.URL;
1.11 import java.net.URLClassLoader;
1.12 @@ -34,6 +34,7 @@
1.13 import org.apache.maven.plugins.annotations.Mojo;
1.14 import org.apache.maven.plugins.annotations.Parameter;
1.15 import org.apache.maven.project.MavenProject;
1.16 +import org.apidesign.vm4brwsr.Bck2Brwsr;
1.17
1.18 /** Compiles classes into JavaScript. */
1.19 @Mojo(name="j2js", defaultPhase=LifecyclePhase.PROCESS_CLASSES)
1.20 @@ -72,14 +73,10 @@
1.21
1.22 try {
1.23 URLClassLoader url = buildClassLoader(classes, prj.getDependencyArtifacts());
1.24 -
1.25 - Class<?> c = Class.forName("org.apidesign.vm4brwsr.GenJS");
1.26 - Method m = c.getDeclaredMethod("compile", ClassLoader.class, Appendable.class, String[].class);
1.27 - m.setAccessible(true);
1.28 FileWriter w = new FileWriter(javascript);
1.29 - m.invoke(null, url, w, arr.toArray(new String[0]));
1.30 + Bck2Brwsr.generate(w, url, arr.toArray(new String[0]));
1.31 w.close();
1.32 - } catch (Exception ex) {
1.33 + } catch (IOException ex) {
1.34 throw new MojoExecutionException("Can't compile", ex);
1.35 }
1.36 }