private void copyResource(URI resource, Set<String> entries, JarOutputStream jarOut) throws IOException { if ("file".equals(resource.getScheme())) { File file = new File(resource); if (file.isDirectory()) { saveDirEntry(resourcesDir, entries, jarOut); copyDir(file, resourcesDir, entries, jarOut); return; } } URL url = resource.toURL(); String path = url.getFile(); String prefix = path.endsWith(".jar") ? libDir : resourcesDir; path = prefix + path.substring(path.lastIndexOf('/') + 1); if (entries.add(path)) { saveDirEntry(prefix, entries, jarOut); jarOut.putNextEntry(new JarEntry(path)); try (InputStream is = url.openStream()) { ByteStreams.copy(is, jarOut); } } }
private void copyResource(URI resource, Set<String> entries, JarOutputStream jarOut) throws IOException { if ("file".equals(resource.getScheme())) { File file = new File(resource); if (file.isDirectory()) { saveDirEntry(resourcesDir, entries, jarOut); copyDir(file, resourcesDir, entries, jarOut); return; } } URL url = resource.toURL(); String path = url.getFile(); String prefix = path.endsWith(".jar") ? libDir : resourcesDir; path = prefix + path.substring(path.lastIndexOf('/') + 1); if (entries.add(path)) { saveDirEntry(prefix, entries, jarOut); jarOut.putNextEntry(new JarEntry(path)); try (InputStream is = url.openStream()) { ByteStreams.copy(is, jarOut); } } }
copyDir(new File(classPathUrl.toURI()), classesDir, entries, jarOut); } catch (Exception e) { throw Throwables.propagate(e);
copyDir(new File(classPathUrl.toURI()), classesDir, entries, jarOut); } catch (Exception e) { throw Throwables.propagate(e);