views:

755

answers:

1

I have eclipse code formatter and profile xml docs and I'd like to build a checkstyle.xml which I can use in my maven builds to run reports and generate the eclipse files. maven-eclipse-plugin appears to be able to generate the eclipse files from the checkstyle.xml (I think), but I'm not sure how to go the other way and I'm not looking forward to doing it by hand.

If data flows via maven from checkstyle -> eclipse it should flow in the reverse direction.

Does anyone know how to generate a checkstyle.xml from the 2 eclipse files?

+1  A: 

Not all data transformations are bidirectional, so it does not necessarily follow that because you can transform from Checkstyle to Eclipse that the inverse transformation can be applied.

In this case I think it is more a case of requirements and having a single canonical configuration source. The Maven Checkstyle configuration is required for all Maven builds. As a convenience it makes sense to have a tool that maps the configuration into the IDE so the validations can be applied during the Eclipse build (this is what the checkstyle-m2eclipse integration does).

Generally it's a good idea to have one canonical source for your configuration, and it makes most sense from a build portability perspective for that to be the Maven configuration. So while you could probably technically transform in the other direction you aren't gaining much by doing so. Out of interest, what benefit do you think this transformation would be to you?

Rich Seller
I'd like this because I have the two eclipse files and do not have a checkstyle.xml file. I'd like to use checkstyle and jumpstart by converting the two eclipse files into a single checkstyle.xml.Otherwise, I'll need to do this manually (which sounds like the case). So, i'll manually convert the two eclipse files into a checkstle then do away with them and have checkstyle generate the eclipse checkers in future.
Peter Kahn
I see, sorry I can't be of more help
Rich Seller
No problem, I just wanted to avoid the manual translation of two xml schemas if there was a good automated way. There isn't, so I have the opportunity to understand checkstyle better (which will be a help when I try to explain problems to others)
Peter Kahn