From 4c05d5f098d117bf5b5ee9e3edeef9d87efe9682 Mon Sep 17 00:00:00 2001 From: Nick Maynard Date: Wed, 23 Nov 2016 07:07:25 +0000 Subject: [PATCH] Allow Java source formatting mvn formatter:format (#4214) Uses Eclipse formatting tools with a configuration matching Google's style guide (plus our customisations). --- eclipse-formatter.xml | 341 +++++++++++++++++++ modules/swagger-codegen-cli/pom.xml | 8 + modules/swagger-codegen-maven-plugin/pom.xml | 10 + modules/swagger-codegen/pom.xml | 8 + modules/swagger-generator/pom.xml | 8 + pom.xml | 31 ++ 6 files changed, 406 insertions(+) create mode 100644 eclipse-formatter.xml diff --git a/eclipse-formatter.xml b/eclipse-formatter.xml new file mode 100644 index 00000000000..a2b5fd1e1f0 --- /dev/null +++ b/eclipse-formatter.xml @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/swagger-codegen-cli/pom.xml b/modules/swagger-codegen-cli/pom.xml index 6b56d5a6f56..36482e0752b 100644 --- a/modules/swagger-codegen-cli/pom.xml +++ b/modules/swagger-codegen-cli/pom.xml @@ -61,6 +61,14 @@ + + net.revelc.code + formatter-maven-plugin + + + ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml + + diff --git a/modules/swagger-codegen-maven-plugin/pom.xml b/modules/swagger-codegen-maven-plugin/pom.xml index 4df64ca4e61..85ac4a99433 100644 --- a/modules/swagger-codegen-maven-plugin/pom.xml +++ b/modules/swagger-codegen-maven-plugin/pom.xml @@ -83,5 +83,15 @@ + + + net.revelc.code + formatter-maven-plugin + + + ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml + + + diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index 21e44ce2547..6288700712b 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -110,6 +110,14 @@ maven-release-plugin 2.5.3 + + net.revelc.code + formatter-maven-plugin + + + ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml + + diff --git a/modules/swagger-generator/pom.xml b/modules/swagger-generator/pom.xml index c44e4c2afd0..c086715639f 100644 --- a/modules/swagger-generator/pom.xml +++ b/modules/swagger-generator/pom.xml @@ -119,6 +119,14 @@ + + net.revelc.code + formatter-maven-plugin + + + ${project.basedir}${file.separator}${project.parent.relativePath}${file.separator}eclipse-formatter.xml + + diff --git a/pom.xml b/pom.xml index 562011ff714..b85e4885cb9 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,26 @@ target ${project.artifactId}-${project.version} + + net.revelc.code + formatter-maven-plugin + + + + 1.7 + 1.7 + 1.7 + LF + + org.apache.maven.plugins maven-checkstyle-plugin @@ -77,6 +97,8 @@ validate google_checkstyle.xml + + ${project.build.sourceDirectory} UTF-8 true true @@ -201,6 +223,15 @@ + + + + net.revelc.code + formatter-maven-plugin + 0.5.2 + + +