Permalink
Browse files

Allow Java source formatting mvn formatter:format (#4214)

Uses Eclipse formatting tools with a configuration matching Google's style guide (plus our customisations).
  • Loading branch information...
nickcmaynard authored and wing328 committed Nov 23, 2016
1 parent ba194ba commit 4c05d5f098d117bf5b5ee9e3edeef9d87efe9682

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -61,6 +61,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<configuration>
<!-- Point at the eclipse-formatter.xml in the swagger-codegen parent project directory -->
<configFile>${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
@@ -83,5 +83,15 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<configuration>
<!-- Point at the eclipse-formatter.xml in the swagger-codegen parent project directory -->
<configFile>${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -110,6 +110,14 @@
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<configuration>
<!-- Point at the eclipse-formatter.xml in the swagger-codegen parent project directory -->
<configFile>${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
@@ -119,6 +119,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<configuration>
<!-- Point at the eclipse-formatter.xml in the swagger-codegen parent project directory -->
<configFile>${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
31 pom.xml
@@ -67,6 +67,26 @@
<directory>target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<!-- Uncomment this to format before checkstyle -->
<!-- <executions>
<execution>
<id>format</id>
<phase>validate</phase>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions> -->
<configuration>
<compilerSource>1.7</compilerSource>
<compilerCompliance>1.7</compilerCompliance>
<compilerTargetPlatform>1.7</compilerTargetPlatform>
<lineEnding>LF</lineEnding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -77,6 +97,8 @@
<phase>validate</phase>
<configuration>
<configLocation>google_checkstyle.xml</configLocation>
<!-- Don't include generated sources a la http://stackoverflow.com/a/30406454 -->
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
@@ -201,6 +223,15 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>0.5.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>

0 comments on commit 4c05d5f

Please sign in to comment.