in src/main/java/org/apache/maven/plugin/doap/DoapMojo.java [983:1057]
private void writeCategory(XMLWriter writer, MavenProject project) {
if (StringUtils.isEmpty(doapOptions.getCategory()) && (category == null || category.isEmpty())) {
messages.addMessage(
new String[] {"doapOptions", "category"}, null, UserMessages.REQUIRED_BY_ASF_OR_RECOMMENDED);
return;
}
// TODO: how to lookup category, map it, or just declare it.
boolean addComment = false;
String comment = "A category of project.";
if (category != null && !category.isEmpty()) // backward compatible
{
getLog().warn("The <category/> parameter is deprecated, please use "
+ messages.toConfiguration(new String[] {"doapOptions", "category"}, null)
+ " parameter instead of.");
category = category.trim();
if (asfExtOptions.isIncluded()) {
String asfCategory = ASFExtOptionsUtil.getCategorySupportedByASF(category);
if (asfCategory == null) {
messages.getErrorMessages()
.add("The deprecated " + messages.toConfiguration(new String[] {"category"}, category)
+ " parameter is not supported by ASF. Should be one of "
+ Arrays.toString(ASFExtOptionsUtil.CATEGORIES));
} else {
DoapUtil.writeComment(writer, comment);
addComment = true;
DoapUtil.writeRdfResourceElement(
writer,
doapOptions.getXmlnsPrefix(),
"category",
ASFExtOptionsUtil.CATEGORY_RESOURCE + asfCategory);
}
} else {
DoapUtil.writeComment(writer, comment);
addComment = true;
DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "category", category);
}
}
if (StringUtils.isNotEmpty(doapOptions.getCategory())) {
String[] categories = StringUtils.split(doapOptions.getCategory(), ",");
for (String category : categories) {
category = category.trim();
if (asfExtOptions.isIncluded()) {
String asfCategory = ASFExtOptionsUtil.getCategorySupportedByASF(category);
if (asfCategory == null) {
messages.getErrorMessages()
.add("The "
+ messages.toConfiguration(new String[] {"doapOptions", "category"}, category)
+ " parameter is not supported by ASF. Should be one of "
+ Arrays.toString(ASFExtOptionsUtil.CATEGORIES));
} else {
if (!addComment) {
DoapUtil.writeComment(writer, comment);
addComment = true;
}
DoapUtil.writeRdfResourceElement(
writer,
doapOptions.getXmlnsPrefix(),
"category",
ASFExtOptionsUtil.CATEGORY_RESOURCE + asfCategory);
}
} else {
if (!addComment) {
DoapUtil.writeComment(writer, comment);
addComment = true;
}
DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "category", category);
}
}
}
}