@@ -157,18 +157,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
157
157
@Parameter (defaultValue = ' ${project.reporting.outputDirectory}/xref-test' )
158
158
File xrefTestLocation
159
159
160
- /* * The directories containing the sources to be compiled. */
161
- @Parameter (defaultValue = ' ${project.compileSourceRoots}' , required = true , readonly = true )
162
- List compileSourceRoots
163
-
164
- /**
165
- * The directories containing the test-sources to be compiled.
166
- *
167
- * @since 2.0
168
- */
169
- @Parameter (defaultValue = ' ${project.testCompileSourceRoots}' , required = true , readonly = true )
170
- List testSourceRoots
171
-
172
160
/**
173
161
* Run Spotbugs on the tests.
174
162
*
@@ -663,8 +651,8 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
663
651
generator. setIsJXRReportEnabled(isJxrPluginEnabled)
664
652
665
653
if (isJxrPluginEnabled) {
666
- generator. setCompileSourceRoots(this . compileSourceRoots)
667
- generator. setTestSourceRoots(this . testSourceRoots )
654
+ generator. setCompileSourceRoots(session . getCurrentProject() . compileSourceRoots)
655
+ generator. setTestSourceRoots(session . getCurrentProject() . testCompileSourceRoots )
668
656
generator. setXrefLocation(this . xrefLocation)
669
657
generator. setXrefTestLocation(this . xrefTestLocation)
670
658
generator. setIncludeTests(this . includeTests)
@@ -723,8 +711,8 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
723
711
XDocsReporter xDocsReporter = new XDocsReporter (getBundle(locale), log, threshold, effort, outputEncoding)
724
712
xDocsReporter. setOutputWriter(Files . newBufferedWriter(Paths . get(" ${ xmlOutputDirectory} /spotbugs.xml" ), Charset . forName(outputEncoding)))
725
713
xDocsReporter. setSpotbugsResults(new XmlSlurper (). parse(outputSpotbugsFile))
726
- xDocsReporter. setCompileSourceRoots(this . compileSourceRoots)
727
- xDocsReporter. setTestSourceRoots(this . testSourceRoots )
714
+ xDocsReporter. setCompileSourceRoots(session . getCurrentProject() . compileSourceRoots)
715
+ xDocsReporter. setTestSourceRoots(session . getCurrentProject() . testCompileSourceRoots )
728
716
729
717
xDocsReporter. generateReport()
730
718
}
@@ -938,9 +926,9 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
938
926
log. debug(" Adding Source directories (To process source exclusions)" )
939
927
args << " -sourcepath"
940
928
String sourceRoots = " "
941
- compileSourceRoots. each() { sourceRoots + = it + File . pathSeparator }
929
+ session . getCurrentProject() . compileSourceRoots. each() { sourceRoots + = it + File . pathSeparator }
942
930
if (includeTests) {
943
- testSourceRoots . each() { sourceRoots + it + File . pathSeparator }
931
+ session . getCurrentProject() . testCompileSourceRoots . each() { sourceRoots + it + File . pathSeparator }
944
932
}
945
933
args << sourceRoots. substring(0 , sourceRoots. length() -1 )
946
934
}
@@ -1149,12 +1137,12 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
1149
1137
1150
1138
def xmlProject = path.Project
1151
1139
1152
- compileSourceRoots. each() { compileSourceRoot ->
1140
+ session . getCurrentProject() . compileSourceRoots. each() { compileSourceRoot ->
1153
1141
xmlProject. appendNode { SrcDir (compileSourceRoot) }
1154
1142
}
1155
1143
1156
1144
if (testClassFilesDirectory. isDirectory() && includeTests) {
1157
- testSourceRoots . each() { testSourceRoot ->
1145
+ session . getCurrentProject() . testCompileSourceRoots . each() { testSourceRoot ->
1158
1146
xmlProject. appendNode { SrcDir (testSourceRoot) }
1159
1147
}
1160
1148
}
0 commit comments