在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):spotify/fmt-maven-plugin开源软件地址(OpenSource Url):https://github.com/spotify/fmt-maven-plugin开源编程语言(OpenSource Language):Java 99.0%开源软件介绍(OpenSource Introduction):fmt-maven-pluginUPDATE 2022-02-14: This plugin has moved from coveooss to the spotify Github org. The new groupId will be 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, google-java-format also includes integrations for IntelliJ and Eclipse IDE's, following the installation instructions on the README. UsageStandard pom.xmlTo have your sources automatically formatted on each build, add to your pom.xml: <build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>VERSION</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> If you prefer, you can only check formatting at build time using the <build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>VERSION</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> Overriding the Default Lifecycle PhaseBoth goals have a Maven lifecycle phase configured by default.
You may prefer to run these goals in a different phase instead. For example, you may prefer that the <execution>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution> Options
example: <build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>VERSION</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>
<skip>false</skip>
<skipSortingImports>false</skipSortingImports>
<style>google</style>
</configuration>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> check Options
example to not display the non-compliant files: <build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>VERSION</version>
<configuration>
<displayFiles>false</displayFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> example to limit the display up to 10 files <build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>VERSION</version>
<configuration>
<displayLimit>10</displayLimit>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> example to only warn about non-compliant files instead of failing the build <build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>VERSION</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> Command lineYou can also use it on the command line
You can pass parameters via standard
Using with Java 8Starting from version 1.8, Google Java Formatter requires Java 11 to run. Incidently, all versions of this plugin starting from 2.10 inclusively also require this Java version to properly function. The 2.9.x release branch is the most up-to-date version that still runs on Java 8. Deploy
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论