System.setProperties((Properties) sysProps.clone());
System.setProperty("user.dir", targetDir.getAbsolutePath());
maven.execute(parent,
Collections.singletonList("archetype:create"),
eventMonitor,
new ConsoleDownloadMonitor(),
props,
targetDir);
System.setProperties((Properties) sysProps.clone());
targetDir = new File(targetDir, "sample");
System.setProperty("user.dir", targetDir.getAbsolutePath());
System.setProperty("basedir", targetDir.getAbsolutePath());
MavenProject prj = maven.readProject(new File(targetDir, "pom.xml"));
maven.execute(prj,
Collections.singletonList("package"),
eventMonitor,
new ConsoleDownloadMonitor(),
new Properties(),
targetDir);
}