I had an issue recently where a branch had been formatted by eclipse and made a merge from Trunk to Branch reasonably difficult. These things happen – so the solution was to find a plugin that would allow me to format both HEAD and Branch consistently outside of eclipse.
The first step was to export my eclipse preferences from eclipse –
Preferences > Java > Code Style > Formatter
Eclipse Preferences
The next step was to find a plugin that would apply these changes. I opted for formatter-maven-plugin
Then it was a matter of adding it to both master poms –
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>0.5.2</version>
<configuration>
<configFile>${session.executionRootDirectory}\eclipse-formatter.xml</configFile>
</configuration>
<dependencies>
<dependency>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>0.5.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
Then run the plugin on both branch and trunk –
mvn formatter:format
Commit then continue with your merge
Like this:
Like Loading...