diff --git a/src/main/java/org/openrewrite/maven/ResourceParser.java b/src/main/java/org/openrewrite/maven/ResourceParser.java index 050df538..7daf33ed 100644 --- a/src/main/java/org/openrewrite/maven/ResourceParser.java +++ b/src/main/java/org/openrewrite/maven/ResourceParser.java @@ -62,10 +62,12 @@ public List parseSourceFiles( return false; } - String pathStr = path.toString(); - if (pathStr.contains("/target/") || pathStr.contains("/build/") || pathStr.contains("/out/") || - pathStr.contains("/.gradle/") || pathStr.contains("/node_modules/") || pathStr.contains("/.metadata/")) { - return false; + for(Path pathSegment : searchDir.relativize(path)) { + String pathStr = pathSegment.toString(); + if("target".equals(pathStr) || "build".equals(pathStr) || "out".equals(pathStr) || + ".gradle".equals(pathStr) || "node_modules".equals(pathStr) || ".metadata".equals(pathStr)) { + return false; + } } if (attrs.isDirectory() || attrs.size() == 0) {