private void copy(String source, String dest, Project p) throws IOException { File f = p.getWorkspace().getFile("maven/" + source + ".tmpl"); InputStream in; if (f.isFile()) { in = new FileInputStream(f); } else { in = MavenPlugin.class.getResourceAsStream(source); if (in == null) { p.error("Cannot find Maven default for %s", source); return; } } String s = IO.collect(in); String process = p.getReplacer().process(s); File d = p.getFile(dest); d.getParentFile().mkdirs(); IO.store(process, d); }
private void doRoot(Project p, File root) throws IOException { if (!root.isFile()) { IO.delete(root); copy("rootpom.xml", "../pom.xml", p); } }