1.1 --- a/boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java Thu Dec 12 23:59:50 2013 +0100
1.2 +++ b/boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java Fri Dec 13 07:40:45 2013 +0100
1.3 @@ -63,8 +63,8 @@
1.4 * @return the transformed bytecode
1.5 * @since 0.7
1.6 */
1.7 - public static byte[] transform(byte[] bytecode, Map<String,InputStream> resources) {
1.8 - return transform(null, bytecode);
1.9 + public static byte[] transform(byte[] bytecode, ClassLoader resources) {
1.10 + return transform(resources, bytecode);
1.11 }
1.12
1.13 public static boolean isJavaScriptCapable(ClassLoader l) {
2.1 --- a/html4j-maven-plugin/src/main/java/org/apidesign/html/mojo/ProcessJsAnnotationsMojo.java Thu Dec 12 23:59:50 2013 +0100
2.2 +++ b/html4j-maven-plugin/src/main/java/org/apidesign/html/mojo/ProcessJsAnnotationsMojo.java Fri Dec 13 07:40:45 2013 +0100
2.3 @@ -26,9 +26,16 @@
2.4 import java.io.FileOutputStream;
2.5 import java.io.IOException;
2.6 import java.io.InputStream;
2.7 +import java.net.MalformedURLException;
2.8 +import java.net.URL;
2.9 +import java.net.URLClassLoader;
2.10 +import java.util.ArrayList;
2.11 import java.util.Enumeration;
2.12 import java.util.HashMap;
2.13 +import java.util.List;
2.14 import java.util.Map;
2.15 +import java.util.logging.Level;
2.16 +import java.util.logging.Logger;
2.17 import java.util.zip.ZipEntry;
2.18 import java.util.zip.ZipFile;
2.19 import org.apache.maven.artifact.Artifact;
2.20 @@ -73,6 +80,18 @@
2.21 }
2.22
2.23 if (processProvided) {
2.24 + List<URL> arr = new ArrayList<URL>();
2.25 + for (Artifact a : prj.getArtifacts()) {
2.26 + final File f = a.getFile();
2.27 + if (f != null) {
2.28 + try {
2.29 + arr.add(f.toURI().toURL());
2.30 + } catch (MalformedURLException ex) {
2.31 + throw new IllegalStateException(ex);
2.32 + }
2.33 + }
2.34 + }
2.35 + URLClassLoader l = new URLClassLoader(arr.toArray(new URL[arr.size()]));
2.36 for (Artifact a : prj.getArtifacts()) {
2.37 if (!"provided".equals(a.getScope())) {
2.38 continue;
2.39 @@ -80,7 +99,7 @@
2.40 final File f = a.getFile();
2.41 if (f != null) {
2.42 try {
2.43 - processClasses(f, classes);
2.44 + processClasses(f, classes, l);
2.45 } catch (IOException ex) {
2.46 throw new MojoExecutionException("Problem converting JavaScriptXXX annotations in " + f, ex);
2.47 }
2.48 @@ -143,7 +162,7 @@
2.49 }
2.50 }
2.51
2.52 - private void processClasses(File jar, File target) throws IOException {
2.53 + private void processClasses(File jar, File target, ClassLoader l) throws IOException {
2.54 ZipFile zf = new ZipFile(jar);
2.55 Enumeration<? extends ZipEntry> en = zf.entries();
2.56 Map<String,byte[]> waiting = new HashMap<String, byte[]>();
2.57 @@ -161,7 +180,7 @@
2.58 is.close();
2.59 }
2.60 if (ze.getName().endsWith(".class")) {
2.61 - byte[] newArr = FnUtils.transform(arr, null);
2.62 + byte[] newArr = FnUtils.transform(arr, l);
2.63 if (newArr == null || newArr == arr) {
2.64 waiting.put(ze.getName(), arr);
2.65 continue;