@@ -874,15 +874,15 @@ protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine,
874
874
* @return a collection of exceptions that may have occurred while resolving
875
875
* and scanning the dependencies
876
876
*/
877
- private ExceptionCollection collectDependencies (Engine engine , MavenProject project ,
877
+ private ExceptionCollection collectMavenDependencies (Engine engine , MavenProject project ,
878
878
List <DependencyNode > nodes , ProjectBuildingRequest buildingRequest , boolean aggregate ) {
879
879
ExceptionCollection exCol = null ;
880
880
for (DependencyNode dependencyNode : nodes ) {
881
881
if (artifactScopeExcluded .passes (dependencyNode .getArtifact ().getScope ())
882
882
|| artifactTypeExcluded .passes (dependencyNode .getArtifact ().getType ())) {
883
883
continue ;
884
884
}
885
- exCol = collectDependencies (engine , project , dependencyNode .getChildren (), buildingRequest , aggregate );
885
+ exCol = collectMavenDependencies (engine , project , dependencyNode .getChildren (), buildingRequest , aggregate );
886
886
boolean isResolved = false ;
887
887
File artifactFile = null ;
888
888
String artifactId = null ;
@@ -985,6 +985,28 @@ private ExceptionCollection collectDependencies(Engine engine, MavenProject proj
985
985
}
986
986
}
987
987
}
988
+ return exCol ;
989
+ }
990
+
991
+ /**
992
+ * Scans the projects dependencies including the default (or defined)
993
+ * FileSets.
994
+ *
995
+ * @param engine the core dependency-check engine
996
+ * @param project the project being scanned
997
+ * @param nodes the list of dependency nodes, generally obtained via the
998
+ * DependencyGraphBuilder
999
+ * @param buildingRequest the Maven project building request
1000
+ * @param aggregate whether the scan is part of an aggregate build
1001
+ * @return a collection of exceptions that may have occurred while resolving
1002
+ * and scanning the dependencies
1003
+ */
1004
+ private ExceptionCollection collectDependencies (Engine engine , MavenProject project ,
1005
+ List <DependencyNode > nodes , ProjectBuildingRequest buildingRequest , boolean aggregate ) {
1006
+
1007
+ ExceptionCollection exCol = null ;
1008
+ exCol = collectMavenDependencies (engine , project , nodes , buildingRequest , aggregate );
1009
+
988
1010
FileSet [] projectScan = scanSet ;
989
1011
if (scanSet == null || scanSet .length == 0 ) {
990
1012
// Define the default FileSets
@@ -1005,6 +1027,38 @@ private ExceptionCollection collectDependencies(Engine engine, MavenProject proj
1005
1027
1006
1028
} else if (aggregate ) {
1007
1029
//TODO build the correct scan set for the child project?
1030
+ projectScan = new FileSet [scanSet .length ];
1031
+ for (int x = 0 ; x < scanSet .length ; x ++) {
1032
+ //deep copy of the FileSet - modifying the directory if it is not absolute.
1033
+ FileSet copyFrom = scanSet [x ];
1034
+ FileSet fsCopy = new FileSet ();
1035
+
1036
+ File f = new File (copyFrom .getDirectory ());
1037
+ if (f .isAbsolute ()) {
1038
+ fsCopy .setDirectory (copyFrom .getDirectory ());
1039
+ } else {
1040
+ try {
1041
+ fsCopy .setDirectory (new File (project .getBasedir (), copyFrom .getDirectory ()).getCanonicalPath ());
1042
+ } catch (IOException ex ) {
1043
+ if (exCol == null ) {
1044
+ exCol = new ExceptionCollection ();
1045
+ }
1046
+ exCol .addException (ex );
1047
+ fsCopy .setDirectory (copyFrom .getDirectory ());
1048
+ }
1049
+ }
1050
+ fsCopy .setDirectoryMode (copyFrom .getDirectoryMode ());
1051
+ fsCopy .setExcludes (copyFrom .getExcludes ());
1052
+ fsCopy .setFileMode (copyFrom .getFileMode ());
1053
+ fsCopy .setFollowSymlinks (copyFrom .isFollowSymlinks ());
1054
+ fsCopy .setIncludes (copyFrom .getIncludes ());
1055
+ fsCopy .setLineEnding (copyFrom .getLineEnding ());
1056
+ fsCopy .setMapper (copyFrom .getMapper ());
1057
+ fsCopy .setModelEncoding (copyFrom .getModelEncoding ());
1058
+ fsCopy .setOutputDirectory (copyFrom .getOutputDirectory ());
1059
+ fsCopy .setUseDefaultExcludes (copyFrom .isUseDefaultExcludes ());
1060
+ projectScan [x ] = fsCopy ;
1061
+ }
1008
1062
}
1009
1063
1010
1064
// Iterate through FileSets and scan included files
0 commit comments