kordamp/enforcer-gradle-plugin

Message is never displayed, enforcer rule is not mentioned

Closed this issue · 1 comments

I'm deliberately trying to get my project to fail by setting project.version to a not compliant string ("-foo").

rule<RequireGradleProperty> {
    enabled.set(true)
    property.set("project.version")
    regex.set("\\d.*\$")
    message.set("Project version must start with a number.")
}

It fails alright, but the specified message is never printed.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':neo-autoconfigure'.
> [BEFORE_PROJECT :neo-autoconfigure] An Enforcer rule has failed

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

Running with --info doesn't yield any additional information (i.e. which enforcer rule caused the build failure).

The enforcer-specific --info output is

[project-enforcer :] phase=AFTER_PROJECT, enabled=true, failFast=true
[project-enforcer :] Detected Java String: '1.8.0_272'
[project-enforcer :] Normalized Java String: '1.8.0-272'
[project-enforcer :] Parsed Version: Major: 1 Minor: 8 Incremental: 0 Build: 272 Qualifier: null
[project-enforcer :] Detected JDK Version: 1.8.0-272 is allowed in the range [1.8,1.9),[11,12),[17,18).

> Configure project :neo-autoconfigure
[project-enforcer :] phase=BEFORE_PROJECT, enabled=true, failFast=true

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

The name of the property must be "version", not "project.version".