You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was thinking on starting work for the maven plugin, so this issue is to ask whether anyone has already started to work, and to act as a placeholder for related discussion.
@jbduncan Unfortunately I have nothing working to share. I tried starting with building a hello world maven plugin in the gradle build of spotless but despite putting quite an effort I was unable to make it work.
If you can get your head around that, then you may be able to gradually build up the build.gradle in this brand-new project so it looks more like Spotless's, and then track down what's causing you problems.
You're welcome @gaganis. I'm sorry that I can't provide any easier-to-follow or more specific advice in this situation. I wish you best of luck with these endeavours. :)
An alternative would be to use maven directly, with maven-wrapper and a pom.xml. The reason for that being that maven has great support for generating its plugins, e.g. maven-invoker integration tests and so on.
@leonard84 That could be done, but it would mean that we couldn't share Gradle build script settings in build.gradle and gradle/*.gradle with the pom.xml, which would introduce build logic duplication, I suspect.
We're happy to take whatever is easiest - duplicating build logic in maven might be easier than reinventing maven's plugin development in gradle. Author's choice :)
@leonard84 That sounds like a neat idea IMO. (Having viewed how Spring Boot does it with Maven-to-Gradle, it seems perfectly doable the other way around.)
In that case, I'm happy regardless of whether the Maven plugin is managed with Gradle or Maven, since we can eventually tie everything with Gradle if needed (as future work). :)
Looks good so far @leonard84! I just have a couple of comments (1, 2) about the current implementation, but other than that, it looks like a good starting point.
But first of all, if you're intending continue, then I'd encourage you to wait a bit, as I believe @gaganis is still working on this himself.
@gaganis, do you find @leonard84's contribution so far helpful for your own efforts? Would you be happy if @leonard84 continues down his own avenue, on the understanding that he may tread on your toes? Overall, is this issue something that you still want to work on?
@leonard84 Oh I beg your pardon! 🙇♂️ @nedtwigg tells me that it's much better to freely allow people to develop code on GitHub without feeling that they're being co-ordinated; to allow so-called "permissionless innovation", since it gets things done quicker.
So please disregard my earlier comment on waiting up a bit. By all means, continue with your efforts at whatever pace that you feel comfortable with. :)
Thanks to a tremendous effort from @lutovich, we now have a fantastic implementation of spotless-maven-plugin deployed to maven-central. You can see the docs here.
We've currently shipped as 1.0.0.BETA1, but there are no known defects. It's only BETA because it hasn't been battle-tested on many projects yet.
We'd love some example projects to link to for the example configurations section, please give it a try and let us know how it goes. Once we've got a couple examples to link to, we'll release the real 1.0 and trumpet its arrival more broadly.
Reacted by Ned Twigg, Jonathan Bluett-Duncan, Matthias Balke and Giorgos Gaganis
First of all thank you very very much @lutovich for implementing the first version of the maven plugin of spotless! This is a big step for maven projects!
Second I would like to contribute some more steps like generic.EndWithNewlineStep, generic.IndentStep, generic.TrimTrailingWhitespaceStep, generic.ReplaceStep and generic.ReplaceRegexStep. As soon as I'm finished with these simple steps I would like to implement a more complex one. Maybe groovy.GrEclipseFormatterStep. But let's start with the simple ones 😏
I'll plan to start this afternoon (~ 16:00 MEZ / 8:00 PST). Just let me know if any of you are already implementing those, so we don't do the same work.
We introduced another bug in 1.0.0.BETA3, but fixed it in 1.0.0.BETA4. Thanks to #223, we now support Kotlin in addition to the Java and Scala we supported before. It seems to me that we're ready to cut the 1.0.0 release, and do some publicity, except that we don't have an open-source example project that we can point to. Anybody have anything open-source they can get a PR merged-in to?
I think we've had something really useful to people for about a month now, would be a shame to keep it under wraps for longer just cuz there's no example project.
Huge thanks to @lutovich for pushing this to the finish line, but also to everybody who contributed great bug reports and fixes. Now that we have an example project thanks to @jbduncan and @jrtom, I think we're ready to publicize this a little. Here's the announcement tweet:
Activity
jbduncan commentedon Apr 13, 2017
Hi @gaganis, I haven't done any work towards the Maven plugin myself, but I don't know about @nedtwigg...
nedtwigg commentedon Apr 13, 2017
The maven plugin is completely greenfield. It's all yours :)
jbduncan commentedon May 30, 2017
@gaganis Do you have any initial work that you can share with us, or has this fallen off your radar?
gaganis commentedon May 30, 2017
@jbduncan Unfortunately I have nothing working to share. I tried starting with building a hello world maven plugin in the gradle build of spotless but despite putting quite an effort I was unable to make it work.
I tried using https://dev.liferay.com/develop/reference/-/knowledge_base/7-0/maven-plugin-builder-gradle-plugin and also using mavenEmbedder directly but I got stuck which is why I did no progress.
My latest non-working attempt was using the following maven-plugin build.gradle file:
https://gist.github.com/gaganis/fb0a8d1e27bbaf61281b9314a62bd95b
This is definitely still on my radar and I am planning to give it another try.
Any help on building the plugin would be very welcome 😄
jbduncan commentedon May 31, 2017
May I suggest applying maven-plugin-builder-gradle-plugin to a brand-new Gradle Java project, where its only Java source file is a "Hello World" Mojo (as described near the start of https://maven.apache.org/guides/plugin/guide-java-plugin-development.html)?
If you can get your head around that, then you may be able to gradually build up the
build.gradlein this brand-new project so it looks more like Spotless's, and then track down what's causing you problems.gaganis commentedon Jun 5, 2017
Thank you for the feedback @jbduncan 😄 I will try your suggestion.
jbduncan commentedon Jun 5, 2017
You're welcome @gaganis. I'm sorry that I can't provide any easier-to-follow or more specific advice in this situation. I wish you best of luck with these endeavours. :)
leonard84 commentedon Jun 8, 2017
An alternative would be to use maven directly, with maven-wrapper and a pom.xml. The reason for that being that maven has great support for generating its plugins, e.g. maven-invoker integration tests and so on.
jbduncan commentedon Jun 8, 2017
@leonard84 That could be done, but it would mean that we couldn't share Gradle build script settings in
build.gradleandgradle/*.gradlewith thepom.xml, which would introduce build logic duplication, I suspect.nedtwigg commentedon Jun 8, 2017
We're happy to take whatever is easiest - duplicating build logic in maven might be easier than reinventing maven's plugin development in gradle. Author's choice :)
leonard84 commentedon Jun 9, 2017
Spring Boot does it the other way round (building gradle-plugin within a maven project) https://github.com/spring-projects/spring-boot/tree/master/spring-boot-tools. You basically need to write an adapter build.gradle file that calls maven.
jbduncan commentedon Jun 9, 2017
@leonard84 That sounds like a neat idea IMO. (Having viewed how Spring Boot does it with Maven-to-Gradle, it seems perfectly doable the other way around.)
In that case, I'm happy regardless of whether the Maven plugin is managed with Gradle or Maven, since we can eventually tie everything with Gradle if needed (as future work). :)
leonard84 commentedon Jun 9, 2017
@jbduncan I created a small proof of concept here https://github.com/leonard84/spotless/tree/mvn-plugin
It works by using a templated pom.xml and injects the gradle.properties, then it uses the maven-wrapper in an exec task to execute the maven build.
What still needs to be done:
installtask of the lib to use the local maven repositoryjbduncan commentedon Jun 9, 2017
Looks good so far @leonard84! I just have a couple of comments (1, 2) about the current implementation, but other than that, it looks like a good starting point.
But first of all, if you're intending continue, then I'd encourage you to wait a bit, as I believe @gaganis is still working on this himself.
@gaganis, do you find @leonard84's contribution so far helpful for your own efforts? Would you be happy if @leonard84 continues down his own avenue, on the understanding that he may tread on your toes? Overall, is this issue something that you still want to work on?
1 remaining item
jbduncan commentedon Jun 9, 2017
@leonard84 Oh I beg your pardon! 🙇♂️ @nedtwigg tells me that it's much better to freely allow people to develop code on GitHub without feeling that they're being co-ordinated; to allow so-called "permissionless innovation", since it gets things done quicker.
So please disregard my earlier comment on waiting up a bit. By all means, continue with your efforts at whatever pace that you feel comfortable with. :)
nedtwigg commentedon Feb 12, 2018
Thanks to a tremendous effort from @lutovich, we now have a fantastic implementation of
spotless-maven-plugindeployed to maven-central. You can see the docs here.We've currently shipped as
1.0.0.BETA1, but there are no known defects. It's only BETA because it hasn't been battle-tested on many projects yet.We'd love some example projects to link to for the example configurations section, please give it a try and let us know how it goes. Once we've got a couple examples to link to, we'll release the real
1.0and trumpet its arrival more broadly.matthiasbalke commentedon Feb 15, 2018
First of all thank you very very much @lutovich for implementing the first version of the maven plugin of spotless! This is a big step for maven projects!
Second I would like to contribute some more steps like
generic.EndWithNewlineStep,generic.IndentStep,generic.TrimTrailingWhitespaceStep,generic.ReplaceStepandgeneric.ReplaceRegexStep. As soon as I'm finished with these simple steps I would like to implement a more complex one. Maybegroovy.GrEclipseFormatterStep. But let's start with the simple ones 😏I'll plan to start this afternoon (~ 16:00 MEZ / 8:00 PST). Just let me know if any of you are already implementing those, so we don't do the same work.
nedtwigg commentedon Feb 16, 2018
A publishing bug was found in
1.0.0.BETA1, fixed in1.0.0.BETA2.@matthiasbalke - great, I think you're the only one working on these, and they would be great to have! If you have any questions, feel free to ask in https://gitter.im/diffplug/spotless
nedtwigg commentedon Mar 13, 2018
We introduced another bug in
1.0.0.BETA3, but fixed it in1.0.0.BETA4. Thanks to #223, we now support Kotlin in addition to the Java and Scala we supported before. It seems to me that we're ready to cut the1.0.0release, and do some publicity, except that we don't have an open-source example project that we can point to. Anybody have anything open-source they can get a PR merged-in to?I think we've had something really useful to people for about a month now, would be a shame to keep it under wraps for longer just cuz there's no example project.
jbduncan commentedon Mar 13, 2018
@nedtwigg For various reasons, it's taking longer than expected for jrtom/jung#198 to be merged in to allow JUNG to be used as an example project.
I'll let you know when I know more. :)
nedtwigg commentedon Apr 27, 2018
Anybody have an example project we can link to yet?
jbduncan commentedon Apr 27, 2018
So sorry @nedtwigg, not sure yet still when my PR for JUNG will be looked at. :(
I'll let you know when I know more.
nedtwigg commentedon Jul 24, 2018
Bump: any opensource projects we can point to as an example?
jbduncan commentedon Jul 24, 2018
Oops, JUNG still can't be used as an example, as @jrtom and I have not been doing anything for that project for quite a while now!
Any others?
nedtwigg commentedon Jul 30, 2018
Great work @jbduncan, looks like spotless got merged into jung. Can I include this in the examples from the readme?
jbduncan commentedon Jul 30, 2018
Certainly, go ahead! I'm sure @jrtom would be ok with this. :)
jrtom commentedon Jul 30, 2018
Yep, fine by me. :)
nedtwigg commentedon Aug 8, 2018
Huge thanks to @lutovich for pushing this to the finish line, but also to everybody who contributed great bug reports and fixes. Now that we have an example project thanks to @jbduncan and @jrtom, I think we're ready to publicize this a little. Here's the announcement tweet:
https://twitter.com/NedTwigg/status/1027216025853415425