in src/main/java/org/apache/maven/plugin/doap/DoapMojo.java [1184:1226]
private void writeLicenses(XMLWriter writer, MavenProject project) {
String license = DoapUtil.interpolate(doapOptions.getLicense(), project, settings);
if (license == null || license.isEmpty()) {
boolean added = false;
@SuppressWarnings("unchecked")
List<License> licenses = project.getLicenses();
if (licenses.size() > 1) {
for (int i = 1; i < licenses.size(); i++) {
if (StringUtils.isEmpty(licenses.get(i).getUrl())) {
continue;
}
String licenseUrl = licenses.get(i).getUrl().trim();
try {
new URL(licenseUrl);
DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "license", licenseUrl);
added = true;
} catch (MalformedURLException e) {
messages.addMessage(
new String[] {"project", "licenses", "license", "url"},
licenseUrl,
UserMessages.INVALID_URL);
}
}
}
if (!added) {
messages.addMessage(
new String[] {"doapOptions", "license"}, null, UserMessages.REQUIRED_BY_ASF_OR_RECOMMENDED);
}
return;
}
try {
new URL(license);
DoapUtil.writeComment(writer, "The URI of the license the software is distributed under.");
DoapUtil.writeRdfResourceElement(writer, doapOptions.getXmlnsPrefix(), "license", license);
} catch (MalformedURLException e) {
messages.addMessage(new String[] {"doapOptions", "license"}, license, UserMessages.INVALID_URL);
}
}