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

Gradle Spotless Integration for Java Formatting? #243

Open
jtgoen opened this issue May 12, 2023 · 3 comments
Open

Gradle Spotless Integration for Java Formatting? #243

jtgoen opened this issue May 12, 2023 · 3 comments
Assignees
Milestone

Comments

@jtgoen
Copy link

jtgoen commented May 12, 2023

My project is planning to move toward integrating the gradle spotless plugin into our workflow, and have gotten to the point where we can apply our spotless configuration to our Java code via pre-commit hook as well as direct invocation via gradle and their VSCode Plugin.

Many of us on the project use NetBeans, and were hoping to integrate our spotless setup into the editor workflow via e.g. format on save, etc with this plugin.

However, looking at the overview page it seems that while applying formatters directly that spotless allows us to leverage through configuration (e.g. Google formatter, eclipse, Spring, etc) is supported, it doesn't look like there's direct spotless support for Java through this plugin?

I only ask since it seems spotless is being leveraged successfully for DBeaver SQL formatting, so maybe it's easier than it seems to integrate for Java?

Let me know if this is already supported and I'm just not understanding something, or if supporting this would be too significant a lift.

Thanks!

@funfried
Copy link
Owner

Hi @jtgoen,

first of all thanks for your interest in the formatter plugin for NetBeans.

So far, I didn't see any reason to integrate the spotless Java formatter as it just wraps the Google and Palantir Java formatter and their both already included, therefore I just used the ones I need, but sure the formatter is already included as a dependency and I could add it as a choice as well.

I'll check the sources and add the formatter in the next release if that helps you.

Cheers,
Fabian

@funfried funfried added this to the 1.15.4 milestone Jul 26, 2023
@funfried funfried self-assigned this Jul 26, 2023
@funfried
Copy link
Owner

@jtgoen I finally had the time to look into the Spotless Code and I think I have an idea what you are looking for, but I don't think it fits into this plugin as it is only meant for formatting code and Spotless seems to do a bit more than just formatting. Maybe I could still include some of the features from Spotless into the NetBeans plugin, but it seems Spotless is working only with folders and not with single files, but NetBeans in most cases works with files and just in some cases with folders.

I will have a closer look into this, it could help to see an example Maven/Gradle Spotless Plugin configuration to get an idea how you are using it, would be great if you could provide your configuration and what you would expect to be done within NetBeans as well.

But I will move this ticket into the next major version as it will be a bit more work as I expected.

@funfried funfried modified the milestones: 1.15.4, 1.16.0 Aug 16, 2023
@jtgoen
Copy link
Author

jtgoen commented Aug 16, 2023

@funfried Thanks for following up on this! In the interim it seems our project has been having difficulty integrating the previously mentioned VSCode Extension that exhibited the behavior we were hoping for (hasn't been updated since last year, so likely some light code rot), so we're currently stuck with formatting through our Gradle spotlessApply task manually and through git hooks.

I'll see about throwing together a small toy example of how our project has the Spotless Plugin configured to demonstrate our current use-case.

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

No branches or pull requests

2 participants