@@ -371,13 +371,15 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
371
371
@ Parameter (property = "artifactoryAnalyzerEnabled" )
372
372
private Boolean artifactoryAnalyzerEnabled ;
373
373
/**
374
- * The serverId inside the settings.xml containing the username and token to access artifactory
374
+ * The serverId inside the settings.xml containing the username and token to
375
+ * access artifactory
375
376
*/
376
377
@ SuppressWarnings ("CanBeFinal" )
377
378
@ Parameter (property = "artifactoryAnalyzerServerId" , defaultValue = "artifactory" )
378
379
private String artifactoryAnalyzerServerId ;
379
380
/**
380
- * The username (only used with API token) to connect to Artifactory instance
381
+ * The username (only used with API token) to connect to Artifactory
382
+ * instance
381
383
*/
382
384
@ SuppressWarnings ("CanBeFinal" )
383
385
@ Parameter (property = "artifactoryAnalyzerUsername" , defaultValue = "artifactory" )
@@ -657,7 +659,6 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
657
659
658
660
// </editor-fold>
659
661
//<editor-fold defaultstate="collapsed" desc="Base Maven implementation">
660
-
661
662
/**
662
663
* Determines if the groupId, artifactId, and version of the Maven
663
664
* dependency and artifact match.
@@ -676,7 +677,7 @@ private static boolean artifactsMatch(org.apache.maven.model.Dependency d, Artif
676
677
* Compares two strings for equality; if both strings are null they are
677
678
* considered equal.
678
679
*
679
- * @param left the first string to compare
680
+ * @param left the first string to compare
680
681
* @param right the second string to compare
681
682
* @return true if the strings are equal or if they are both null; otherwise
682
683
* false.
@@ -689,8 +690,8 @@ private static boolean isEqualOrNull(String left, String right) {
689
690
* Executes dependency-check.
690
691
*
691
692
* @throws MojoExecutionException thrown if there is an exception executing
692
- * the mojo
693
- * @throws MojoFailureException thrown if dependency-check failed the build
693
+ * the mojo
694
+ * @throws MojoFailureException thrown if dependency-check failed the build
694
695
*/
695
696
@ Override
696
697
public void execute () throws MojoExecutionException , MojoFailureException {
@@ -723,7 +724,7 @@ private void validateAggregate() throws MojoExecutionException {
723
724
/**
724
725
* Generates the Dependency-Check Site Report.
725
726
*
726
- * @param sink the sink to write the report to
727
+ * @param sink the sink to write the report to
727
728
* @param locale the locale to use when generating the report
728
729
* @throws MavenReportException if a maven report exception occurs
729
730
* @deprecated use
@@ -766,7 +767,7 @@ protected boolean isFailOnError() {
766
767
/**
767
768
* Generates the Dependency-Check Site Report.
768
769
*
769
- * @param sink the sink to write the report to
770
+ * @param sink the sink to write the report to
770
771
* @param locale the locale to use when generating the report
771
772
* @throws MavenReportException if a maven report exception occurs
772
773
*/
@@ -799,7 +800,7 @@ public void generate(Sink sink, Locale locale) throws MavenReportException {
799
800
*
800
801
* @return the directory to write the report(s)
801
802
* @throws MojoExecutionException thrown if there is an error loading the
802
- * file path
803
+ * file path
803
804
*/
804
805
protected File getCorrectOutputDirectory () throws MojoExecutionException {
805
806
return getCorrectOutputDirectory (this .project );
@@ -829,7 +830,7 @@ protected File getCorrectOutputDirectory(MavenProject current) {
829
830
* list.
830
831
*
831
832
* @param project the project to scan the dependencies of
832
- * @param engine the engine to use to scan the dependencies
833
+ * @param engine the engine to use to scan the dependencies
833
834
* @return a collection of exceptions that may have occurred while resolving
834
835
* and scanning the dependencies
835
836
*/
@@ -841,8 +842,8 @@ protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine)
841
842
* Scans the project's artifacts and adds them to the engine's dependency
842
843
* list.
843
844
*
844
- * @param project the project to scan the dependencies of
845
- * @param engine the engine to use to scan the dependencies
845
+ * @param project the project to scan the dependencies of
846
+ * @param engine the engine to use to scan the dependencies
846
847
* @param aggregate whether the scan is part of an aggregate build
847
848
* @return a collection of exceptions that may have occurred while resolving
848
849
* and scanning the dependencies
@@ -864,17 +865,17 @@ protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine,
864
865
* Resolves the projects artifacts using Aether and scans the resulting
865
866
* dependencies.
866
867
*
867
- * @param engine the core dependency-check engine
868
- * @param project the project being scanned
869
- * @param nodes the list of dependency nodes, generally obtained via the
870
- * DependencyGraphBuilder
868
+ * @param engine the core dependency-check engine
869
+ * @param project the project being scanned
870
+ * @param nodes the list of dependency nodes, generally obtained via the
871
+ * DependencyGraphBuilder
871
872
* @param buildingRequest the Maven project building request
872
- * @param aggregate whether the scan is part of an aggregate build
873
+ * @param aggregate whether the scan is part of an aggregate build
873
874
* @return a collection of exceptions that may have occurred while resolving
874
875
* and scanning the dependencies
875
876
*/
876
877
private ExceptionCollection collectDependencies (Engine engine , MavenProject project ,
877
- List <DependencyNode > nodes , ProjectBuildingRequest buildingRequest , boolean aggregate ) {
878
+ List <DependencyNode > nodes , ProjectBuildingRequest buildingRequest , boolean aggregate ) {
878
879
ExceptionCollection exCol = null ;
879
880
for (DependencyNode dependencyNode : nodes ) {
880
881
if (artifactScopeExcluded .passes (dependencyNode .getArtifact ().getScope ())
@@ -984,9 +985,9 @@ private ExceptionCollection collectDependencies(Engine engine, MavenProject proj
984
985
}
985
986
}
986
987
}
987
-
988
- // Define the default FileSets
988
+ FileSet [] projectScan = scanSet ;
989
989
if (scanSet == null || scanSet .length == 0 ) {
990
+ // Define the default FileSets
990
991
final FileSet resourcesSet = new FileSet ();
991
992
final FileSet filtersSet = new FileSet ();
992
993
final FileSet webappSet = new FileSet ();
@@ -1000,11 +1001,15 @@ private ExceptionCollection collectDependencies(Engine engine, MavenProject proj
1000
1001
}
1001
1002
exCol .addException (ex );
1002
1003
}
1003
- scanSet = new FileSet []{resourcesSet , filtersSet , webappSet };
1004
+ projectScan = new FileSet []{resourcesSet , filtersSet , webappSet };
1005
+
1006
+ } else if (aggregate ) {
1007
+ //TODO build the correct scan set for the child project?
1004
1008
}
1009
+
1005
1010
// Iterate through FileSets and scan included files
1006
1011
final FileSetManager fileSetManager = new FileSetManager ();
1007
- for (FileSet fileSet : scanSet ) {
1012
+ for (FileSet fileSet : projectScan ) {
1008
1013
final String [] includedFiles = fileSetManager .getIncludedFiles (fileSet );
1009
1014
for (String include : includedFiles ) {
1010
1015
final File includeFile = new File (fileSet .getDirectory (), include ).getAbsoluteFile ();
@@ -1023,7 +1028,7 @@ private ExceptionCollection collectDependencies(Engine engine, MavenProject proj
1023
1028
* have not yet been built. If true a virtual dependency is created based on
1024
1029
* the evidence in the project.
1025
1030
*
1026
- * @param engine a reference to the engine being used to scan
1031
+ * @param engine a reference to the engine being used to scan
1027
1032
* @param artifact the artifact being analyzed in the mojo
1028
1033
* @return <code>true</code> if the artifact is in the reactor; otherwise
1029
1034
* <code>false</code>
@@ -1117,9 +1122,9 @@ public ProjectBuildingRequest newResolveArtifactProjectBuildingRequest() {
1117
1122
* Executes the dependency-check scan and generates the necessary report.
1118
1123
*
1119
1124
* @throws MojoExecutionException thrown if there is an exception running
1120
- * the scan
1121
- * @throws MojoFailureException thrown if dependency-check is configured to
1122
- * fail the build
1125
+ * the scan
1126
+ * @throws MojoFailureException thrown if dependency-check is configured to
1127
+ * fail the build
1123
1128
*/
1124
1129
protected void runCheck () throws MojoExecutionException , MojoFailureException {
1125
1130
try (Engine engine = initializeEngine ()) {
@@ -1177,10 +1182,10 @@ protected void runCheck() throws MojoExecutionException, MojoFailureException {
1177
1182
* MojoExecutionException
1178
1183
*
1179
1184
* @param currentEx the primary exception collection
1180
- * @param newEx the new exception collection to add
1185
+ * @param newEx the new exception collection to add
1181
1186
* @return the combined exception collection
1182
1187
* @throws MojoExecutionException thrown if dependency-check is configured
1183
- * to fail on errors
1188
+ * to fail on errors
1184
1189
*/
1185
1190
private ExceptionCollection handleAnalysisExceptions (ExceptionCollection currentEx , ExceptionCollection newEx ) throws MojoExecutionException {
1186
1191
ExceptionCollection returnEx = currentEx ;
@@ -1382,7 +1387,6 @@ protected void populateSettings() {
1382
1387
settings .setBooleanIfNotNull (Settings .KEYS .ANALYZER_ARTIFACTORY_USES_PROXY , artifactoryAnalyzerUseProxy );
1383
1388
settings .setBooleanIfNotNull (Settings .KEYS .ANALYZER_ARTIFACTORY_PARALLEL_ANALYSIS , artifactoryAnalyzerParallelAnalysis );
1384
1389
1385
-
1386
1390
if (Boolean .TRUE .equals (artifactoryAnalyzerEnabled )) {
1387
1391
if (artifactoryAnalyzerServerId != null ) {
1388
1392
final Server server = settingsXml .getServer (artifactoryAnalyzerServerId );
@@ -1575,14 +1579,13 @@ protected Settings getSettings() {
1575
1579
}
1576
1580
1577
1581
//<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary">
1578
-
1579
1582
/**
1580
1583
* Checks to see if a vulnerability has been identified with a CVSS score
1581
1584
* that is above the threshold set in the configuration.
1582
1585
*
1583
1586
* @param dependencies the list of dependency objects
1584
1587
* @throws MojoFailureException thrown if a CVSS score is found that is
1585
- * higher then the threshold set
1588
+ * higher then the threshold set
1586
1589
*/
1587
1590
protected void checkForFailure (Dependency [] dependencies ) throws MojoFailureException {
1588
1591
final StringBuilder ids = new StringBuilder ();
@@ -1623,7 +1626,7 @@ protected void checkForFailure(Dependency[] dependencies) throws MojoFailureExce
1623
1626
* Generates a warning message listing a summary of dependencies and their
1624
1627
* associated CPE and CVE entries.
1625
1628
*
1626
- * @param mp the Maven project for which the summary is shown
1629
+ * @param mp the Maven project for which the summary is shown
1627
1630
* @param dependencies a list of dependency objects
1628
1631
*/
1629
1632
protected void showSummary (MavenProject mp , Dependency [] dependencies ) {
@@ -1664,7 +1667,6 @@ protected void showSummary(MavenProject mp, Dependency[] dependencies) {
1664
1667
1665
1668
//</editor-fold>
1666
1669
//<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file">
1667
-
1668
1670
/**
1669
1671
* Returns the key used to store the path to the data file that is saved by
1670
1672
* <code>writeDataFile()</code>. This key is used in the
0 commit comments