Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] how to see the details of error #24

Open
rr-nick-tan opened this issue May 13, 2022 · 11 comments
Open

[question] how to see the details of error #24

rr-nick-tan opened this issue May 13, 2022 · 11 comments

Comments

@rr-nick-tan
Copy link

hi @aalmiray

thanks for the gradle plugin, i come from maven enforcer plugin which is used in most of our projects.

i have the project enforcer setup with BanDuplicateClasses rule

    enforce {
        rule(enforcer.rules.BanDuplicateClasses)
    }

the build failed but without any detail, i don't know which classes are duplicate.

$ ./gradlew build
Type-safe dependency accessors is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':demo-service'.
> [AFTER_PROJECT :demo-service] An Enforcer rule has failed

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

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
@aalmiray
Copy link
Contributor

When a rule fails there should be a print out explaining the failure. All rules behave like that.
Do you have a reproducible project where this behavior can be observed?

@rr-nick-tan
Copy link
Author

unfortunately i can't share the project, could you share the tips of diagnosing? thx

@aalmiray
Copy link
Contributor

Can you reproduce with a smaller self-contained project?

@estroykov
Copy link

HI @aalmiray! Thanks for the plugin.

I faced the same issue, though. Here is a project to reproduce: https://github.com/estroykov/enforcer-gradle-plugin-rule-is-not-specified-in-output

@aalmiray
Copy link
Contributor

aalmiray commented Jul 8, 2024

@estroykov thank you for the link to the repository. However, its configuration does not match the reported issue and thus can't reproduce what @rr-nick-tan encountered.

@estroykov
Copy link

@aalmiray Do you mean I use other rule in my example? Ok, anyway, is there any way to have a name (or custom message) of a failed rule in my case?

@aalmiray
Copy link
Contributor

aalmiray commented Jul 8, 2024

I believe every rule exposes a message property you may use to set a custom message. https://kordamp.org/enforcer-gradle-plugin/#_rules

@estroykov
Copy link

@aalmiray I did use message property (see link above) but it didn't affect output.

@andrey-vasilyev
Copy link

@aalmiray I have the same issue, could you please take a look?

I also noticed something suspicious with integration tests. Do all zeros look ok to you?
изображение

@aalmiray
Copy link
Contributor

I can see the custom message if the plugin is applied to the settings.gradle file but not to build.gradle. There may be a timing issue or a missing collector for error messages.

@andrey-vasilyev
Copy link

I can see the custom message if the plugin is applied to the settings.gradle file but not to build.gradle. There may be a timing issue or a missing collector for error messages.

Ok and do you think it is an issue or not? I would like to apply it to build.gradle and missing message confuses devs about what actually is wrong - so it seems like an issue to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants