对多个 Maven 项目运行 Fortify 扫描

问题描述 投票:0回答:2

我有多个项目由单个父 pom 绑定。

如果我使用 Maven fortify 插件在父 pom 上运行 fortify 扫描,则会生成每个项目的 fpr 文件。我希望为所有项目生成一个 fpr 文件。可能吗?

感谢和问候, 索拉夫

fortify
2个回答
7
投票

您想要做的是聚合构建。尝试为每个模块设置相同的构建ID,然后传递-Dfortify.sca.toplevel.artifactId作为父POM的artifactID。这将为您提供一个 FPR 文件。它应该看起来像:

mvn clean
mvn -Dfortify.sca.buildId=ACMEPortal com.fortify.ps.maven.plugin:sca-maven-plugin:<version>:clean
mvn -Dfortify.sca.buildId=ACMEPortal package com.fortify.ps.maven.plugin:sca-maven-plugin:<version>:translate
mvn -Dfortify.sca.Xmx=800M -Dfortify.sca.buildId=ACMEPortal -Dfortify.sca.toplevel.artifactId=AcmePortal com.fortify.ps.maven.plugin:sca-maven-plugin:<version>:scan

0
投票

最新版本的 SCA Maven Plugin 默认聚合扫描,因此基于模块的 Maven 项目不再需要任何显式设置。从插件文档(下面摘录)可以明显看出:

$mvn com.fortify.sca.plugins.maven:sca-maven-plugin:help -Ddetail=true -Dgoal=scan

输出:

可用参数:

aggregate (Default: true)
  If set to true, aggregate mode is enabled.
  User property: fortify.sca.aggregate

buildId (Default: ${project.artifactId}-${project.version})
  Specifies the SCA build ID. The default is project artifact ID and
  version. In aggregate mode, the top level project artifact ID and version
  is used for all modules.
© www.soinside.com 2019 - 2024. All rights reserved.