Skip to content

Commit 0efa6bc

Browse files
authored
Reduce classpath scanner logging (#3099)
When `cucumber.glue` is not configured Cucumber scans the entire classpath for glue. This "just works". However, when scanning encounters a class with missing dependencies Cucumber log complain quite loudly about this. The assumption was that this scenario would be quite rare, and it was until IDEA (intentionally and on request) stopped setting `cucumber.glue`. Now it is no longer a rare occurance.
1 parent 6476597 commit 0efa6bc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
## [Unreleased]
1313
### Fixed
1414
- [Core] Prefer URIs with authority ([#3098](https://github.com/cucumber/cucumber-jvm/pull/3098) M.P. Korstanje)
15+
- [Core] Reduce classpath scanner logging ([#3099](https://github.com/cucumber/cucumber-jvm/pull/3099) M.P. Korstanje)
1516

1617
### Added
1718
- [Core] Add a `UsageJsonFormatter`, use with `--plugin usage-json` ([#3086](https://github.com/cucumber/cucumber-jvm/pull/3086) M.P. Korstanje)

cucumber-core/src/main/java/io/cucumber/core/resource/ClasspathScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.util.function.Predicate;
1515
import java.util.function.Supplier;
1616

17-
import static io.cucumber.core.resource.ClasspathSupport.classPathScanningExplanation;
1817
import static io.cucumber.core.resource.ClasspathSupport.determineFullyQualifiedClassName;
1918
import static io.cucumber.core.resource.ClasspathSupport.getUrisForPackage;
2019
import static io.cucumber.core.resource.ClasspathSupport.requireValidPackageName;
@@ -106,7 +105,8 @@ private Optional<Class<?>> safelyLoadClass(String fqn) {
106105
try {
107106
return Optional.ofNullable(getClassLoader().loadClass(fqn));
108107
} catch (ClassNotFoundException | NoClassDefFoundError e) {
109-
log.warn(e, () -> "Failed to load class '" + fqn + "'.\n" + classPathScanningExplanation());
108+
log.debug(e, () -> "Could not to load class '" + fqn
109+
+ "'. If this is not a Glue class you can ignore this exception.\n");
110110
}
111111
return Optional.empty();
112112
}

0 commit comments

Comments
 (0)