return info;
}
private ComponentLibraryInfo parse(InputStream inputStream)
{
ComponentLibraryInfo info = null;
if (inputStream != null)
{
Document document;
try
{
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.parse(inputStream);
}
catch (Exception e)
{
logger.warn("Exception while parsing pom.xml", e);
return null;
}
info = new ComponentLibraryInfo();
info.setGroupId(extractText(document, "(/project/groupId | /project/parent/groupId)[1]"));
info.setArtifactId(extractText(document, "/project/artifactId"));
info.setVersion(extractText(document, "/project/version"));
info.setName(extractText(document, "/project/name"));
info.setDescription(extractText(document, "/project/description"));
info.setDocumentationUrl(extractText(document, "/project/properties/documentationUrl"));
info.setHomepageUrl(extractText(document, "/project/properties/homepageUrl"));
info.setIssueTrackerUrl(extractText(document, "/project/issueManagement/url"));
info.setJavadocUrl(extractText(document, "/project/properties/javadocUrl"));
info.setSourceBrowseUrl(extractText(document, "/project/scm/url"));
info.setSourceRootUrl(extractText(document, "/project/properties/sourceRootUrl"));
String tags = extractText(document, "/project/properties/tags");
if (tags != null && tags.length() > 0)
{
info.setTags(Arrays.asList(tags.split(",")));
}
}
return info;