Formats your code using google-java-format which follows Google's code styleguide.
The format cannot be configured by design.
If you want your IDE to stick to the same format, check out the available configuration files
Add to your pom.xml
<build>
<plugins>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
sourceDirectory
represents the directory where your Java sources that need to be formatted are contained. It defaults to ${project.build.sourceDirectory}
testSourceDirectory
represents the directory where your test's Java sources that need to be formatted are contained. It defaults to ${project.build.testSourceDirectory}
additionalSourceDirectories
represents a list of additional directories that contains Java sources that need to be formatted. It defaults to an empty list.
verbose
is whether the plugin should print a line for every file that is being formatted. It defaults to false
.
filesNamePattern
represents the pattern that filters files to format. The defaults value is set to .*\.java
.
example:
<build>
<plugins>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<sourceDirectory>some/source/directory</sourceDirectory>
<testSourceDirectory>some/test/directory</testSourceDirectory>
<verbose>true</verbose>
<filesNamePattern>.*\.java</filesNamePattern>
<additionalSourceDirectories>
<param>some/dir</param>
<param>some/other/dir</param>
</additionalSourceDirectories>
</configuration>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
You can also use it on the command line
mvn com.coveo:fmt-maven-plugin:format
You can pass parameters via standard -D
syntax.
mvn com.coveo:fmt-maven-plugin:format -Dverbose=true
git tag v0.0.0
mvn versions:set -DnewVersion=0.0.0
mvn clean deploy -P release