@@ -77,6 +77,23 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
77
77
@Parameter (defaultValue = " false" , property = " spotbugs.sarifFullPath" , required = true )
78
78
boolean sarifFullPath
79
79
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
+
80
97
/**
81
98
* Specifies the directory where the xml output will be generated.
82
99
*
@@ -1122,7 +1139,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
1122
1139
1123
1140
File xmlTempFile = new File (" ${ project.build.directory} /spotbugsTemp.xml" )
1124
1141
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 )
1126
1143
1127
1144
if (xmlOutput || ! sarifOutput) {
1128
1145
forceFileCreation(xmlTempFile)
@@ -1312,6 +1329,8 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
1312
1329
}
1313
1330
}
1314
1331
1332
+ forceFileCreation(sarifFinalFile)
1333
+
1315
1334
sarifFinalFile. withWriter {
1316
1335
builder. writeTo(it)
1317
1336
}
0 commit comments