sherter / google-java-format-gradle-plugin

MIT License
187 stars 36 forks source link
formatter gradle java plugin

= google-java-format-gradle-plugin :release-version: 0.9 :default-google-java-format-version: 1.8 :snapshot-version: 0.9-SNAPSHOT

A https://github.com/gradle/gradle[Gradle] plugin that utilizes https://github.com/google/google-java-format[google-java-format] to format the Java source files in your Gradle project.

image:https://travis-ci.org/sherter/google-java-format-gradle-plugin.svg?branch=master["Build Status", link="https://travis-ci.org/sherter/google-java-format-gradle-plugin"]

== Quick Start

== Extended Usage

task format(type: GoogleJavaFormat) { source 'src/main' source 'src/test' include '*/.java' exclude '*/Template.java' }

task verifyFormatting(type: VerifyGoogleJavaFormat) { source 'src/main' include '*/.java' ignoreFailures true }

If you set sources in a task (by calling setSource and/or source), the default inputs from the extension object are not added to the final set of sources to process. However, if you don't modify the sources in the task and only add include and/or exclude patterns, the default inputs are first added and then further filtered according the the patterns.

== Snapshots On every push to the master branch https://travis-ci.org/[Travis] runs the tests and, if all tests pass, publishes the built artifact to https://oss.sonatype.org/content/repositories/snapshots/[Sonatype's snapshots repository]. Use the following build script snippet for the current snapshot version:

[source,groovy] [subs="attributes"]

buildscript { repositories { maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { classpath 'com.github.sherter.googlejavaformatgradleplugin:google-java-format-gradle-plugin:{snapshot-version}' } }

apply plugin: 'com.github.sherter.google-java-format'