InputStream is = getClass().getResourceAsStream(MessageFormat.format("/archetypes/{0}.moxie", project.type));
if (is == null) {
log("Unknown archetype " + project.type);
System.exit(1);
}
MaxmlMap map = null;
try {
map = Maxml.parse(is);
} catch (MaxmlException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (Exception e) {
}
}
// property substitution
Map<String, String> properties = new HashMap<String, String>();
properties.put(Key.groupId.name(), project.groupId);
properties.put(Key.artifactId.name(), project.artifactId);
properties.put(Key.version.name(), project.version);
properties.put(Key.apply.name(), StringUtils.flattenStrings(apply, ", "));
for (String key : map.keySet()) {
Object o = map.get(key);
if (o instanceof String) {
String value = resolveProperties(o.toString(), properties);
map.put(key, value);
}
}
createDirectories(project, map, Key.sourceDirectories);
createDirectories(project, map, Key.resourceDirectories);
// Eclipse-ext dependency directory
if (Eclipse.ext.equals(project.eclipse)) {
map.put(Toolkit.Key.dependencyDirectory.name(), "ext");
}
// write build.moxie
String maxml = map.toMaxml();
moxieFile = new File(project.dir, "build.moxie");
FileUtils.writeContent(moxieFile, maxml);
// write build.xml
try {