//get the pom PSI model
//
final PsiProject psi = PomModelManager.getInstance(pProject).getPsiProject(pPomUrl);
if (psi == null)
return new Artifact[0];
final PsiDependencies deps = psi.getDependencies();
//
//iterate the pom dependencies and collect the artifacts that go in the classpath
//ignoring everything that has a type that differs from "jar" (empty type is
//ok, since the default is "jar")
//
final Set<Artifact> artifacts = new HashSet<Artifact>(deps.getRowCount());
for (int row = 0; row < deps.getRowCount(); row++) {
final String type = deps.getType(row);
if (type != null && !"jar".equalsIgnoreCase(type))
continue;
final Artifact artifact = new Artifact();
artifact.setGroupId(deps.getGroupId(row));
artifact.setArtifactId(deps.getArtifactId(row));
artifact.setType(type);
artifact.setVersion(deps.getVersion(row));
artifact.setExtension(deps.getExtension(row));
artifacts.add(artifact);
}
//
//if the pom extends another pom, aggregate it as well