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

[Feature] Formatting support for springboot apps #40

Closed
Kwandes opened this issue Feb 9, 2021 · 4 comments
Closed

[Feature] Formatting support for springboot apps #40

Kwandes opened this issue Feb 9, 2021 · 4 comments
Labels

Comments

@Kwandes
Copy link

Kwandes commented Feb 9, 2021

Is your feature request related to a problem? Please describe.
NX contains commands for various actions, with some being solely for running the application, while others being used to ensure quality. While this springboot plugin covers everything needed to run and deploy the app, it's missing formatting support.

Describe the idea you'd like
When nx format:check and nx format are run, the springboot apps would be included in the formatting.

Describe alternatives you've considered
An alternative is for developers to manually open their IDEs and use run their formatting tools there, but that is slower and does not work at all in the continuous integration aspect of development

Additional context
This feature would be especially useful in projects with continuous integrations and pull request-based development. A formatting check workflow can be created, which then would clearly state in the PR whether or not the code is properly structured, and ensures consistent coding style.

@Kwandes Kwandes added the 🆕 enhancement New feature or request label Feb 9, 2021
@tinesoft
Copy link
Owner

Hi @Kwandes!

Thank you for the idea 💡. This is interesting, even if I believe the interest is limited,
given that most IDE's have this integrated already and activated upon file save automatically.

However, I agree it could fit well with the nx format commands spirit.

The problem is there is no "default" or "standard" formatter (that I'm aware of) for JVM-based project...

I've found this https://github.com/spring-io/spring-javaformat that might do the job for Java Spring Boot projects, but unfortunatelyy I see no support for 'KotlinnorGroovy`(spring-io/spring-javaformat#149), which is a bummer...

If you have another tool in mind, I'm open to suggestions.

If implemented, this feature would probably be controlled by option at generation to opt-in to the formatting.

@khalilou88
Copy link

Hello, there is this solution too https://github.com/jhipster/prettier-java

@tinesoft
Copy link
Owner

Hi @khalilou88

Thanks for your link. But I think I've come across a more robust/complete alternative: https://github.com/diffplug/spotless !

  • It support Java, Kotlin, Groovy languages out-of-the-box
  • It has maven AND gradle plugins

So all requirements of a Spring Boot project are met at this point!
Plus,

  • It is highly customizable
  • It is actively maintained and has a large community
  • and much more

So , I will start integrate it soon. Stay tuned ;-)

@tinesoft
Copy link
Owner

Hi guys,

Quick follow up, to let you know that formatting of your spring-boot projects has just landed in latest release of nx-spring-boot https://github.com/tinesoft/nxrocks/releases/tag/nx-spring-boot%2Fv4.0.0 🎉 (well v4.0.2 to be exact)

The feature is implemented with Spotless (as described above) and works for Gradle/Maven Java/Kotlin/Groovy based projects.

Enjoy and let me know if you have issues with it !

Cheers

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

No branches or pull requests

3 participants