org.sonar.api.resources.Project.getPom()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.sonar.api.resources.Project.getPom()方法的一些代码示例,展示了Project.getPom()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getPom()方法的具体详情如下:
包路径:org.sonar.api.resources.Project
类名称:Project
方法名:getPom

Project.getPom介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet/sonar-plugin-dotnet-core

/**
 * Extracts a visual studio solution if the project is a valid solution.
 * 
 * @param project
 *          the maven project from which a solution will be extracted
 * @return a visual studio solution
 * @throws DotNetProjectException
 *           if the project is not a valid .Net project
 */
public static VisualStudioSolution getSolution(Project project)
 throws DotNetProjectException {
 MavenProject mavenProject = project.getPom();
 final VisualStudioSolution solution;
 if (solutionCache.containsKey(mavenProject)) {
  solution = solutionCache.get(mavenProject);
 } else {
  solution = VisualStudioUtils.getVisualSolution(mavenProject,
    (String) null);
  solutionCache.put(mavenProject, solution);
 }
 return solution;
}

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

/**
 * Configures the project POM with base required surefire settings
 *
 * @param project the project currently analyzed
 * @return the configured surefire MavenPlugin object instance, cannot be null
 */
public static MavenPlugin configure(Project project) {
 MavenPlugin surefire = MavenPlugin.registerPlugin(project.getPom(), GROUP_ID, ARTIFACT_ID, VERSION, false);
 surefire.setParameter("disableXmlReport", "false");
 surefire.setParameter("testFailureIgnore", "true");
 return surefire;
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

@Override
 public boolean accept(Object extension) {
  if (ExtensionUtils.isType(extension, BatchComponent.class) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_PROJECT)) {
   // Special use-case: the extension point ProjectBuilder is used in a Maven environment to define some
   // new sub-projects without pom.
   // Example : C# plugin adds sub-projects at runtime, even if they are not defined in root pom.
   return !ExtensionUtils.isMavenExtensionOnly(extension) || module.getPom() != null;
  }
  return false;
 }
});

代码示例来源:origin: org.codehaus.sonar.plugins/sonar-surefire-plugin

private static File getReportsDirectoryFromPluginConfiguration(Project project) {
 MavenPlugin plugin = MavenPlugin.getPlugin(project.getPom(), MavenSurefireUtils.GROUP_ID, MavenSurefireUtils.ARTIFACT_ID);
 if (plugin != null) {
  String path = plugin.getParameter("reportsDirectory");
  if (path != null) {
   return project.getFileSystem().resolvePath(path);
  }
 }
 return null;
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/sonar-surefire-plugin

private static File getReportsDirectoryFromPluginConfiguration(Project project) {
 MavenPlugin plugin = MavenPlugin.getPlugin(project.getPom(), MavenSurefireUtils.GROUP_ID, MavenSurefireUtils.ARTIFACT_ID);
 if (plugin != null) {
  String path = plugin.getParameter("reportsDirectory");
  if (path != null) {
   return project.getFileSystem().resolvePath(path);
  }
 }
 return null;
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

private void computeDependencyTree(final Project project, final SensorContext context) {
 LOG.warn("Computation of Maven dependencies by SonarQube is deprecated. Please update the version of SonarQube Maven plugin to 2.5+");
 try {
  DependencyNode root = treeBuilder.buildDependencyTree(project.getPom(), localRepository, artifactFactory, artifactMetadataSource, null, artifactCollector);
  DependencyNodeVisitor visitor = new BuildingDependencyNodeVisitor(new DependencyNodeVisitor() {
   @Override
   public boolean visit(DependencyNode node) {
    return true;
   }
   @Override
   public boolean endVisit(DependencyNode node) {
    if (node.getParent() != null && node.getParent() != node) {
     saveDependency(project, node, context);
    }
    return true;
   }
  });
  // mode verbose OFF : do not show the same lib many times
  DependencyNodeFilter filter = StateDependencyNodeFilter.INCLUDED;
  CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
  DependencyNodeVisitor firstPassVisitor = new FilteringDependencyNodeVisitor(collectingVisitor, filter);
  root.accept(firstPassVisitor);
  DependencyNodeFilter secondPassFilter = new AncestorOrSelfDependencyNodeFilter(collectingVisitor.getNodes());
  visitor = new FilteringDependencyNodeVisitor(visitor, secondPassFilter);
  root.accept(visitor);
 } catch (DependencyTreeBuilderException e) {
  throw new SonarException("Can not load the graph of dependencies of the project " + project.getKey(), e);
 }
}

相关文章