DocumentBuilderFactory factory = XmlUtil.newDocumentBuilderFactory();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
Element root = doc.createElement("metadata");
doc.appendChild(root);
createText(doc, root, "groupId", groupId);
createText(doc, root, "artifactId", artifactId);
if(artifacts.length > 0) {
createText(doc, root, "version", artifacts[0].getVersion().toString());
}