diff --git a/src/main/java/de/thetaphi/forbiddenapis/Checker.java b/src/main/java/de/thetaphi/forbiddenapis/Checker.java
index 4b97ffeb..1f8bf90e 100644
--- a/src/main/java/de/thetaphi/forbiddenapis/Checker.java
+++ b/src/main/java/de/thetaphi/forbiddenapis/Checker.java
@@ -54,6 +54,7 @@ public static enum Option {
FAIL_ON_MISSING_CLASSES,
FAIL_ON_VIOLATION,
FAIL_ON_UNRESOLVABLE_SIGNATURES,
+ LOG_MISSING_SIGNATURES,
DISABLE_CLASSLOADING_CACHE
}
diff --git a/src/main/java/de/thetaphi/forbiddenapis/Signatures.java b/src/main/java/de/thetaphi/forbiddenapis/Signatures.java
index 195e599c..ae92dc40 100644
--- a/src/main/java/de/thetaphi/forbiddenapis/Signatures.java
+++ b/src/main/java/de/thetaphi/forbiddenapis/Signatures.java
@@ -78,6 +78,7 @@ private UnresolvableReporting(boolean reportClassNotFound) {
private final RelatedClassLookup lookup;
private final Logger logger;
private final boolean failOnUnresolvableSignatures;
+ private final boolean logMissingSignatures;
/** Key is used to lookup forbidden signature in following formats:
*
@@ -95,13 +96,14 @@ private UnresolvableReporting(boolean reportClassNotFound) {
private boolean forbidNonPortableRuntime = false;
public Signatures(Checker checker) {
- this(checker, checker.logger, checker.options.contains(Option.FAIL_ON_UNRESOLVABLE_SIGNATURES));
+ this(checker, checker.logger, checker.options.contains(Option.FAIL_ON_UNRESOLVABLE_SIGNATURES), checker.options.contains(Option.LOG_MISSING_SIGNATURES));
}
- public Signatures(RelatedClassLookup lookup, Logger logger, boolean failOnUnresolvableSignatures) {
+ public Signatures(RelatedClassLookup lookup, Logger logger, boolean failOnUnresolvableSignatures, boolean logMissingSignatures) {
this.lookup = lookup;
this.logger = logger;
this.failOnUnresolvableSignatures = failOnUnresolvableSignatures;
+ this.logMissingSignatures = logMissingSignatures;
}
static String getKey(String internalClassName) {
@@ -211,7 +213,7 @@ private void addSignature(final String line, final String defaultMessage, final
}
private void reportMissingSignatureClasses(Set missingClasses) {
- if (missingClasses.isEmpty()) {
+ if (missingClasses.isEmpty() || !logMissingSignatures) {
return;
}
logger.warn("Some signatures were ignored because the following classes were not found on classpath:");
diff --git a/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java b/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java
index 9a8f5d55..2ac2a428 100644
--- a/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java
+++ b/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java
@@ -141,12 +141,21 @@ public abstract class AbstractCheckMojo extends AbstractMojo implements Constant
/**
* Fail the build if a signature is not resolving. If this parameter is set to
- * to false, then such signatures are silently ignored. This is useful in multi-module Maven
+ * to false, then such signatures are ignored. This is useful in multi-module Maven
* projects where only some modules have the dependency to which the signature file(s) apply.
* @since 1.4
*/
@Parameter(required = false, defaultValue = "true")
private boolean failOnUnresolvableSignatures;
+
+ /**
+ * Output a warning in the log if a signature is missing. If this parameter is set to
+ * to false, then such signatures are not logged at all. This is useful in multi-module Maven
+ * projects where only some modules have the dependency to which the signature file(s) apply.
+ * @since 2.7
+ */
+ @Parameter(required = false, defaultValue = "true")
+ private boolean logMissingSignatures;
/**
* Fail the build if violations have been found. Defaults to {@code true}.
@@ -323,6 +332,7 @@ public void info(String msg) {
if (failOnMissingClasses) options.add(FAIL_ON_MISSING_CLASSES);
if (failOnViolation) options.add(FAIL_ON_VIOLATION);
if (failOnUnresolvableSignatures) options.add(FAIL_ON_UNRESOLVABLE_SIGNATURES);
+ if (logMissingSignatures) options.add(LOG_MISSING_SIGNATURES);
if (disableClassloadingCache) options.add(DISABLE_CLASSLOADING_CACHE);
final Checker checker = new Checker(log, loader, options);