-
In maven on the command line I have this plugin configured to format both the main and generated-sources folders. However, within eclipse the configuration has no effect, the plugin is mapped as ignored, and so my generated sources do not get formatted. Is there any way to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can override m2e data in your pom but it's tricky due to eclipse being heart of this plugin. The configure for m2e is necessary and a manual install plus version must match. So generally it's not a good idea with this specific plugin especially if sharedwith varying version of eclipse. Instead import the same config being used into eclipse formatters so you can get the same desired effect using eclipse formatting directly.
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Clinton Popetz ***@***.***>
Sent: Saturday, October 12, 2024 9:04:15 AM
To: revelc/formatter-maven-plugin ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [revelc/formatter-maven-plugin] Formatting generated sources (Discussion #941)
In maven on the command line I have this plugin configured to format both the main and generated-sources folders. However, within eclipse the configuration has no effect, the plugin is mapped as ignored, and so my generated sources do not get formatted. Is there any way to achieve this?
—
Reply to this email directly, view it on GitHub<#941>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAHODIZND32ZLUJ6DNOZY5DZ3EM47AVCNFSM6AAAAABP2MZQCSVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGMYDSNZZHA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
The purpose of the plugin is to standardize formatting during a Maven build for a project, independent of whatever IDE you're using. However, because the underlying library and config is Eclipse JDT, it's possible to share the Maven plugin config with Eclipse, so that your project is formatted while undergoing development in your IDE. There is a m2e configurator that attempts to map configuration into Eclipse at https://github.com/revelc/formatter-m2e-configurator that is designed for that specific purpose. I'm not sure how well the m2e configurator works, and the mapping of this plugin to the m2e configurator is disabled by default and this plugin's actions ignored, because of revelc/formatter-m2e-configurator#1 and revelc/formatter-m2e-configurator#30 which make it difficult to automatically have the configurator installed and available. Even if you got it working, I'm not sure how well it would handle generated sources. I think you'd have to make sure you add the generated source folder to one of Eclipse's source folders using the build-helper-maven-plugin, which has a corresponding Eclipse plugin that is automatically mapped. I do this in one of my projects, and you can see an example at: Setting up the generated source folder as a project source folder may be enough to get Eclipse behaving the way you want it to. However, doing that is outside the scope of this particular plugin which, as I said, is intended to format code during a Maven build independently of IDEs, not to format during an IDE build, which is handled by other tooling. I hope that helps. |
Beta Was this translation helpful? Give feedback.
The purpose of the plugin is to standardize formatting during a Maven build for a project, independent of whatever IDE you're using. However, because the underlying library and config is Eclipse JDT, it's possible to share the Maven plugin config with Eclipse, so that your project is formatted while undergoing development in your IDE. There is a m2e configurator that attempts to map configuration into Eclipse at https://github.com/revelc/formatter-m2e-configurator that is designed for that specific purpose.
I'm not sure how well the m2e configurator works, and the mapping of this plugin to the m2e configurator is disabled by default and this plugin's actions ignored, because of revelc/for…