List of usage examples for org.apache.maven.project MavenProject getDevelopers
public List<Developer> getDevelopers()
From source file:org.sonar.updatecenter.deprecated.UpdateCenter.java
License:Open Source License
private History<Plugin> resolvePluginHistory(String id) throws Exception { String groupId = StringUtils.substringBefore(id, ":"); String artifactId = StringUtils.substringAfter(id, ":"); Artifact artifact = artifactFactory.createArtifact(groupId, artifactId, Artifact.LATEST_VERSION, Artifact.SCOPE_COMPILE, ARTIFACT_JAR_TYPE); List<ArtifactVersion> versions = filterSnapshots( metadataSource.retrieveAvailableVersions(artifact, localRepository, remoteRepositories)); History<Plugin> history = new History<Plugin>(); for (ArtifactVersion version : versions) { Plugin plugin = org.sonar.updatecenter.deprecated.Plugin .extractMetadata(resolve(artifact.getGroupId(), artifact.getArtifactId(), version.toString())); history.addArtifact(version, plugin); MavenProject project = mavenProjectBuilder .buildFromRepository(/* w w w. ja v a2 s. co m*/ artifactFactory.createArtifact(groupId, artifactId, version.toString(), Artifact.SCOPE_COMPILE, ARTIFACT_POM_TYPE), remoteRepositories, localRepository); if (plugin.getVersion() == null) { // Legacy plugin - set default values plugin.setKey(project.getArtifactId()); plugin.setName(project.getName()); plugin.setVersion(project.getVersion()); String sonarVersion = "1.10"; // TODO Is it minimal version for all extension points ? for (Dependency dependency : project.getDependencies()) { if ("sonar-plugin-api".equals(dependency.getArtifactId())) { // TODO dirty hack sonarVersion = dependency.getVersion(); } } plugin.setRequiredSonarVersion(sonarVersion); plugin.setHomepage(project.getUrl()); } plugin.setDownloadUrl(getPluginDownloadUrl(groupId, artifactId, plugin.getVersion())); // There is no equivalent for following properties in MANIFEST.MF if (project.getIssueManagement() != null) { plugin.setIssueTracker(project.getIssueManagement().getUrl()); } else { System.out.println("Unknown Issue Management for " + plugin.getKey() + ":" + plugin.getVersion()); } if (project.getScm() != null) { String scmUrl = project.getScm().getUrl(); if (StringUtils.startsWith(scmUrl, "scm:")) { scmUrl = StringUtils.substringAfter(StringUtils.substringAfter(scmUrl, ":"), ":"); } plugin.setSources(scmUrl); } else { System.out.println("Unknown SCM for " + plugin.getKey() + ":" + plugin.getVersion()); } if (project.getLicenses() != null && project.getLicenses().size() > 0) { plugin.setLicense(project.getLicenses().get(0).getName()); } else { System.out.println("Unknown License for " + plugin.getKey() + ":" + plugin.getVersion()); } if (project.getDevelopers().size() > 0) { plugin.setDevelopers(project.getDevelopers()); } else { System.out.println("Unknown Developers for " + plugin.getKey() + ":" + plugin.getVersion()); } } return history; }