Skip to content

Commit 601961a

Browse files
author
Peter Frank
committed
Added a sourcesPaths array tag that will add multiple Sources to the Cobertura ArgumentBuilder.
E.g. <sourcesPaths> <scourcesPath>${project.basedir}/src/main/groovy/</scourcesPath> <scourcesPath>${project.basedir}/src/main/java/</scourcesPath> </sourcesPaths> Adds support for both groovy files and java files in a GMavenPlus Plugin default layout.
1 parent 6f4e576 commit 601961a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

core/src/main/java/com/qualinsight/mojo/cobertura/core/reporting/AbstractReportMojo.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public abstract class AbstractReportMojo extends AbstractMojo {
5252
@Parameter(defaultValue = "${project.basedir}/src/main/java/", required = false)
5353
private String sourcesPath;
5454

55+
@Parameter(defaultValue = "${project.basedir}/src/main/java/", required = false)
56+
private String[] sourcesPaths;
57+
5558
@Parameter(defaultValue = "UTF-8", required = false)
5659
private String encoding;
5760

@@ -139,6 +142,10 @@ protected String sourcesPath() {
139142
return this.sourcesPath;
140143
}
141144

145+
protected String[] sourcesPaths(){
146+
return this.sourcesPaths;
147+
}
148+
142149
protected String encoding() {
143150
return this.encoding;
144151
}
@@ -152,13 +159,21 @@ protected String[] formats() {
152159
Arguments buildCoberturaReportArguments(final File sourcesDirectory, final File destinationDirectory, final File dataFile) {
153160
getLog().debug("Building Cobertura report generation arguments");
154161
final ArgumentsBuilder builder = new ArgumentsBuilder();
155-
return builder.setBaseDirectory(sourcesDirectory.getAbsolutePath())
162+
builder.setBaseDirectory(sourcesDirectory.getAbsolutePath())
156163
.setDestinationDirectory(destinationDirectory.getAbsolutePath())
157164
.setDataFile(dataFile.getAbsolutePath())
158165
.setEncoding(encoding())
159-
.calculateMethodComplexity(this.calculateMethodComplexity)
160-
.addSources(sourcesPath, true)
161-
.build();
166+
.calculateMethodComplexity(this.calculateMethodComplexity);
167+
168+
if(sourcesPaths != null && sourcesPaths.length > 0) {
169+
for (String sourcesPath : sourcesPaths) {
170+
builder.addSources(sourcesPath, true);
171+
}
172+
}else{
173+
builder.addSources(this.sourcesPath, true);
174+
}
175+
176+
return builder.build();
162177
}
163178

164179
}

0 commit comments

Comments
 (0)