@@ -77,6 +77,23 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
7777 @Parameter (defaultValue = " false" , property = " spotbugs.sarifFullPath" , required = true )
7878 boolean sarifFullPath
7979
80+ /**
81+ * Specifies the directory where the sarif output will be generated.
82+ *
83+ * @since 4.7.2.2
84+ */
85+ @Parameter (defaultValue = ' ${project.build.directory}' , property = " spotbugs.sarifOutputDirectory" , required = true )
86+ File sarifOutputDirectory
87+
88+
89+ /**
90+ * Set the name of the output SARIF file produced
91+ *
92+ * @since 4.7.2.2
93+ */
94+ @Parameter (property = " spotbugs.sarifOutputFilename" , defaultValue = " spotbugsSarif.json" , required = true )
95+ String sarifOutputFilename
96+
8097 /**
8198 * Specifies the directory where the xml output will be generated.
8299 *
@@ -1122,7 +1139,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
11221139
11231140 File xmlTempFile = new File (" ${ project.build.directory} /spotbugsTemp.xml" )
11241141 File sarifTempFile = new File (" ${ project.build.directory} /spotbugsTempSarif.json" )
1125- File sarifFinalFile = new File (" ${ project.build.directory } /spotbugsSarif.json " )
1142+ File sarifFinalFile = new File (sarifOutputDirectory, sarifOutputFilename )
11261143
11271144 if (xmlOutput || ! sarifOutput) {
11281145 forceFileCreation(xmlTempFile)
@@ -1312,6 +1329,8 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
13121329 }
13131330 }
13141331
1332+ forceFileCreation(sarifFinalFile)
1333+
13151334 sarifFinalFile. withWriter {
13161335 builder. writeTo(it)
13171336 }
0 commit comments