2016-12-15 22 views
0

我有一个Maven项目。我已经为此运行了Fortify扫描并成功生成了pdf报告。作为Maven构建的一部分,我现在试图将其整合,并假设添加适当的jar,因为依赖应该完成这项工作。如果强化扫描报告错误,是否有可能失败Maven构建

我的问题是,

  1. 是否有可能导致构建失败,即使所有的代码是好的, 但Fortify的报告产生错误?
  2. 如果是,我如何指定我只希望构建失败,例如 高和严重错误,而不是低和中。

回答

0

您可以使用Maven Enforcer执行该生成不生成报表时出现故障,或者你可以使用一些其他Enforcer rules

例如,有些事情是这样的,当你想失败时,你可以设置phaseRules

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-enforcer-plugin</artifactId> 
    <executions> 
     <execution> 
     <id>enforce-fortify-reports</id> 
     <phase>verify</phase> 
     <goals> 
      <goal>enforce-once</goal> 
     </goals> 
     <configuration> 
      <rules> 
      <requireFilesExist> 
        <files> 
        <file>${project.build.outputDirectory}/report.frp</file> 
        </files> 
       </requireFilesExist> 
      </rules> 
      <fail>true</fail> 
     </configuration> 
     </execution> 
    </executions> 
    </plugin> 
0

(不是一个完整的解决方案,但暗示)

可以使用FPRUtility(SCA的一部分)来检查错误和问题的数量,那么你可以使用Maven或Ant来解析结果和失败的构建。

# fprutility -information -project project.fpr -errors 
[10002] Unable to parse T-SQL at tables.sql:612:3. 
[10002] Unable to parse T-SQL at update.sql:72:27. 

# fprutility -information -project project.fpr -search -query "[fortify priority order]:high OR [fortify priority order]:critical" 
565 issues of 796 matched search query. 

编辑:

注:如果您使用SSC审核问题,您应该首先上传生成.fpr文件,然后检查合并的结果,排除例如抑制的问题。