List of usage examples for org.apache.maven.project MavenProject getReportPlugins
@Deprecated
public List<ReportPlugin> getReportPlugins()
From source file:hudson.gridmaven.PomInfo.java
License:Open Source License
public PomInfo(MavenProject project, PomInfo parent, String relPath) { this.name = new ModuleName(project); this.version = project.getVersion(); this.displayName = project.getName(); this.defaultGoal = project.getDefaultGoal(); this.relativePath = relPath; this.parent = parent; if (parent != null) parent.children.add(name);// w w w.ja va 2s. c o m for (Dependency dep : (List<Dependency>) project.getDependencies()) dependencies.add(new ModuleDependency(dep)); MavenProject parentProject = project.getParent(); if (parentProject != null) dependencies.add(new ModuleDependency(parentProject)); if (parent != null) dependencies.add(parent.asDependency()); addPluginsAsDependencies(project.getBuildPlugins(), dependencies); addReportPluginsAsDependencies(project.getReportPlugins(), dependencies); List<Extension> extensions = project.getBuildExtensions(); if (extensions != null) for (Extension ext : extensions) dependencies.add(new ModuleDependency(ext)); // when the parent POM uses a plugin and builds a plugin at the same time, // the plugin module ends up depending on itself dependencies.remove(asDependency()); CiManagement ciMgmt = project.getCiManagement(); if ((ciMgmt != null) && (ciMgmt.getSystem() == null || ciMgmt.getSystem().equals("hudson"))) { Notifier mailNotifier = null; for (Notifier n : (List<Notifier>) ciMgmt.getNotifiers()) { if (n.getType().equals("mail")) { mailNotifier = n; break; } } this.mailNotifier = mailNotifier; } else this.mailNotifier = null; this.groupId = project.getGroupId(); this.artifactId = project.getArtifactId(); this.packaging = project.getPackaging(); }
From source file:org.codehaus.mojo.dashboard.report.plugin.DashBoardUtils.java
License:Apache License
public DashBoardMavenProject getDashBoardMavenProject(MavenProject project, String dashboardDataFile, Date generatedDate) {// w ww . j a v a 2 s. co m String projectName = project.getName(); // Fixes MOJO-801. NPE in a particular three level multimodule build this.fillProjectMap(project); DashBoardMavenProject mavenProject; if (project.getModules().size() > 0) { // String artefactId = project.getGroupId() + "." + project.getArtifactId(); mavenProject = new DashBoardMavenProject(project.getArtifactId(), project.getGroupId(), projectName, project.getVersion()); for (int i = 0; i < project.getModules().size(); i++) { String modulename = (String) project.getModules().get(i); MavenProject proj = this.getModuleMavenProject(project, modulename); String key = proj.getGroupId() + "." + proj.getArtifactId(); if (this.projectMap.containsKey(key)) { MavenProject realproj = (MavenProject) this.projectMap.get(key); DashBoardMavenProject subMavenProject = dashBoardUtils.getDashBoardMavenProject(realproj, dashboardDataFile, generatedDate); mavenProject.addModule(subMavenProject); } } } else { mavenProject = new DashBoardMavenProject(project.getArtifactId(), project.getGroupId(), projectName, project.getVersion()); for (Iterator reports = project.getReportPlugins().iterator(); reports.hasNext();) { ReportPlugin report = (ReportPlugin) reports.next(); String artifactId = report.getArtifactId(); AbstractReportBean dashBoardReport = null; if ("maven-checkstyle-plugin".equals(artifactId) || "checkstyle-maven-plugin".equals(artifactId)) { dashBoardReport = this.getCheckstyleReport(project, generatedDate); } else if ("maven-clover-plugin".equals(artifactId)) { dashBoardReport = this.getCloverReport(project, generatedDate); } else if ("maven-surefire-report-plugin".equals(artifactId) || "surefire-report-maven-plugin".equals(artifactId)) { dashBoardReport = this.getSurefireReport(project, generatedDate); } else if ("cobertura-maven-plugin".equals(artifactId) || "maven-cobertura-plugin".equals(artifactId)) { dashBoardReport = this.getCoberturaReport(project, generatedDate); } else if ("maven-pmd-plugin".equals(artifactId) || "pmd-maven-plugin".equals(artifactId)) { dashBoardReport = this.getCpdReport(project, generatedDate); if (dashBoardReport != null) { mavenProject.addReport(dashBoardReport); } dashBoardReport = this.getPmdReport(project, generatedDate); } else if ("maven-findbugs-plugin".equals(artifactId) || "findbugs-maven-plugin".equals(artifactId)) { dashBoardReport = this.getFindBugsReport(project, generatedDate); } else if ("maven-jdepend-plugin".equals(artifactId) || "jdepend-maven-plugin".equals(artifactId)) { if (!this.dbPersist) { dashBoardReport = this.getJDependReport(project, generatedDate); } } else if ("maven-taglist-plugin".equals(artifactId) || "taglist-maven-plugin".equals(artifactId)) { dashBoardReport = this.getTaglistReport(project, generatedDate); } if (dashBoardReport != null) { mavenProject.addReport(dashBoardReport); } } } return mavenProject; }
From source file:org.sonar.api.batch.maven.MavenPlugin.java
License:Open Source License
/** * Returns a plugin from a pom based on its group id and artifact id * <p/>/*w w w.j av a2 s.c o m*/ * <p>It searches in the build section, then the reporting section and finally the pluginManagement section</p> * * @param pom the project pom * @param groupId the plugin group id * @param artifactId the plugin artifact id * @return the plugin if it exists, null otherwise */ public static MavenPlugin getPlugin(MavenProject pom, String groupId, String artifactId) { if (pom == null) { return null; } // look for plugin in <build> section Plugin plugin = null; if (pom.getBuildPlugins() != null) { plugin = getPlugin(pom.getBuildPlugins(), groupId, artifactId); } // look for plugin in <report> section if (plugin == null && pom.getReportPlugins() != null) { plugin = getReportPlugin(pom.getReportPlugins(), groupId, artifactId); } // look for plugin in <pluginManagement> section if (pom.getPluginManagement() != null) { Plugin pluginManagement = getPlugin(pom.getPluginManagement().getPlugins(), groupId, artifactId); if (plugin == null) { plugin = pluginManagement; } else if (pluginManagement != null) { if (pluginManagement.getConfiguration() != null) { if (plugin.getConfiguration() == null) { plugin.setConfiguration(pluginManagement.getConfiguration()); } else { Xpp3Dom.mergeXpp3Dom((Xpp3Dom) plugin.getConfiguration(), (Xpp3Dom) pluginManagement.getConfiguration()); } } if (plugin.getDependencies() == null && pluginManagement.getDependencies() != null) { plugin.setDependencies(pluginManagement.getDependencies()); } if (plugin.getVersion() == null) { plugin.setVersion(pluginManagement.getVersion()); } } } if (plugin != null) { return new MavenPlugin(plugin); } return null; }
From source file:org.sonar.api.batch.maven.MavenPlugin.java
License:Open Source License
private static void unregisterPlugin(MavenProject pom, String groupId, String artifactId) { if (pom.getPluginManagement() != null && pom.getPluginManagement().getPlugins() != null) { unregisterPlugin(pom.getPluginManagement().getPlugins(), groupId, artifactId); }/* w ww . j a v a 2s . c om*/ List plugins = pom.getBuildPlugins(); if (plugins != null) { unregisterPlugin(plugins, groupId, artifactId); } plugins = pom.getReportPlugins(); if (plugins != null) { unregisterReportPlugin(plugins, groupId, artifactId); } }