|
177 | 177 | <mockito.version>5.14.1</mockito.version> |
178 | 178 | <fastjson2.version>2.0.53</fastjson2.version> |
179 | 179 |
|
| 180 | + <git-code-format-maven-plugin.version>5.3</git-code-format-maven-plugin.version> |
180 | 181 | <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version> |
181 | 182 | <maven-install-plugin.version>3.1.3</maven-install-plugin.version> |
182 | 183 | <maven-source-plugin.version>3.3.1</maven-source-plugin.version> |
|
704 | 705 | </executions> |
705 | 706 | </plugin> |
706 | 707 | <plugin> |
707 | | - <groupId>com.marvinformatics.formatter</groupId> |
708 | | - <artifactId>formatter-maven-plugin</artifactId> |
709 | | - <version>2.2.0</version> |
710 | | - <configuration> |
711 | | - <lineEnding>LF</lineEnding> |
712 | | - <configFile>${main.basedir}/src/config/eclipse-java-style.xml</configFile> |
713 | | - <excludes> |
714 | | - <exclude>travis/**</exclude> |
715 | | - <exclude>**/SAXDecoderTest.java</exclude> |
716 | | - </excludes> |
717 | | - </configuration> |
| 708 | + <groupId>com.cosium.code</groupId> |
| 709 | + <artifactId>git-code-format-maven-plugin</artifactId> |
| 710 | + <version>${git-code-format-maven-plugin.version}</version> |
| 711 | + <dependencies> |
| 712 | + <!-- Enable https://github.com/google/google-java-format --> |
| 713 | + <dependency> |
| 714 | + <groupId>com.cosium.code</groupId> |
| 715 | + <artifactId>google-java-format</artifactId> |
| 716 | + <version>${git-code-format-maven-plugin.version}</version> |
| 717 | + </dependency> |
| 718 | + </dependencies> |
718 | 719 | <executions> |
| 720 | + <!-- On commit, format the modified files --> |
719 | 721 | <execution> |
| 722 | + <id>install-formatter-hook</id> |
720 | 723 | <goals> |
721 | | - <goal>format</goal> |
| 724 | + <goal>install-hooks</goal> |
| 725 | + </goals> |
| 726 | + <inherited>false</inherited> |
| 727 | + </execution> |
| 728 | + <!-- On Maven verify phase, fail if any file (including unmodified) is |
| 729 | + badly formatted --> |
| 730 | + <execution> |
| 731 | + <id>validate-code-format</id> |
| 732 | + <goals> |
| 733 | + <goal>validate-code-format</goal> |
722 | 734 | </goals> |
723 | | - <phase>validate</phase> |
724 | 735 | </execution> |
725 | 736 | </executions> |
726 | 737 | </plugin> |
|
882 | 893 | </properties> |
883 | 894 | </profile> |
884 | 895 |
|
885 | | - <profile> |
886 | | - <id>validateCodeFormat</id> |
887 | | - |
888 | | - <build> |
889 | | - <plugins> |
890 | | - <plugin> |
891 | | - <groupId>com.marvinformatics.formatter</groupId> |
892 | | - <artifactId>formatter-maven-plugin</artifactId> |
893 | | - <version>2.2.0</version> |
894 | | - <configuration> |
895 | | - <lineEnding>LF</lineEnding> |
896 | | - <configFile>${main.basedir}/src/config/eclipse-java-style.xml</configFile> |
897 | | - </configuration> |
898 | | - <executions> |
899 | | - <execution> |
900 | | - <id>validate-only</id> |
901 | | - <goals> |
902 | | - <goal>validate</goal> |
903 | | - </goals> |
904 | | - <phase>initialize</phase> |
905 | | - </execution> |
906 | | - </executions> |
907 | | - </plugin> |
908 | | - </plugins> |
909 | | - </build> |
910 | | - </profile> |
911 | | - |
912 | 896 | <profile> |
913 | 897 | <id>release</id> |
914 | 898 | <build> |
|
0 commit comments