You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Contributions are welcome, see [the contributing guide](../CONTRIBUTING.md) for development info.***
@@ -1913,8 +1914,6 @@ If you use this feature, you will get an error if you use a formatter in a subpr
1913
1914
- If you don't like what spotless did, `git reset --hard`
1914
1915
- If you'd like to remove the "checkpoint" commit, `git reset --soft head~1` will make the checkpoint commit "disappear" from history, but keeps the changes in your working directory.
1915
1916
1916
-
<a name="examples"></a>
1917
-
1918
1917
## Can I apply Spotless to specific files?
1919
1918
1920
1919
You can target specific files by setting the `spotlessFiles` project property to a comma-separated list of file patterns:
The patterns are matched using `String#matches(String)` against the absolute file path.
1927
1926
1927
+
<a name="central-configuration"></a>
1928
+
1929
+
## How to centralize Spotless configuration
1930
+
1931
+
If you want to centralize your Spotless configuration for use across many projects, you might want to consider the [Blowdryer](https://github.com/diffplug/blowdryer) plugin.
1932
+
1933
+
If you are content with only centralizing configuration files, it is possible to define a common configuration that is deployed as a standard artifact so that it can be then be reused by each project. For example:
1934
+
1935
+
```kotlin
1936
+
val spotlessConfig by configurations.creating
1937
+
dependencies {
1938
+
// the files `java-import-order.txt` and `java-formatter.xml` should be at the root of the deployed `org.mycompany:code-configuration:1.0.0` jar.
***Contributions are welcome, see [the contributing guide](../CONTRIBUTING.md) for development info.***
@@ -2068,7 +2069,39 @@ You can adjust this with
2068
2069
2069
2070
Note that for Incremental build support the goals have to be bound to a phase prior to `test`.
2070
2071
2071
-
<aname="examples"></a>
2072
+
<aname="central-configuration"></a>
2073
+
2074
+
## How to centralize Spotless configuration
2075
+
2076
+
Rather than copying the formatter files across many projects, it is possible to define a common configuration that is deployed as a standard artifact so that it can be then be reused by each project; for example:
In this example, the files `java-import-order.txt` and `java-formatter.xml` should be at the root of the deployed `org.mycompany:code-configuration:1.0.0` jar.
2072
2105
2073
2106
## Example configurations (from real-world projects)
0 commit comments