Skip to content

Commit

Permalink
check groupArtifact content
Browse files Browse the repository at this point in the history
  • Loading branch information
figroc committed Sep 26, 2021
1 parent fda9094 commit 5aab9d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ public static FormatterStep create(String version, String style, Provisioner pro

/** Creates a step which formats everything - groupArtifact, code, import order, and unused imports - and optionally reflows long strings. */
public static FormatterStep create(String groupArtifact, String version, String style, Provisioner provisioner, boolean reflowLongStrings) {
Objects.requireNonNull(groupArtifact, "artifact");
Objects.requireNonNull(groupArtifact, "groupArtifact");
if (groupArtifact.chars().filter(ch -> ch == ':').count() != 1) {
throw new IllegalArgumentException("groupArtifact must be in the form 'groupId:artifactId'");
}
Objects.requireNonNull(version, "version");
Objects.requireNonNull(style, "style");
Objects.requireNonNull(provisioner, "provisioner");
Expand Down
5 changes: 3 additions & 2 deletions plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ spotless {
spotless {
java {
googleJavaFormat()
// optional: you can specify a specific version and/or switch to AOSP style and/or reflow long strings (requires at least 1.8) and/or use home-brewed artifact
//
// optional: you can specify a specific version and/or switch to AOSP style
// and/or reflow long strings (requires at least 1.8)
// and/or use custom group artifact (you probably don't need this)
googleJavaFormat('1.8').aosp().reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
```

Expand Down
3 changes: 1 addition & 2 deletions plugin-maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ To use it in your pom, just [add the Spotless dependency](https://search.maven.o
<version>1.8</version>
<style>AOSP</style>
<reflowLongStrings>true</reflowLongStrings>
<groupArtifact>com.google.googlejavaformat:google-java-format</groupArtifact>
</googleJavaFormat>

<!-- make sure every file has the following copyright header.
Expand Down Expand Up @@ -206,7 +205,7 @@ any other maven phase (i.e. compile) then it can be configured as below;
<version>1.8</version> <!-- optional -->
<style>GOOGLE</style> <!-- or AOSP (optional) -->
<reflowLongStrings>true</reflowLongStrings> <!-- optional (requires at least 1.8) -->
<!-- optional: home-brewed group artifact -->
<!-- optional: custom group artifact (you probably don't need this) -->
<groupArtifact>com.google.googlejavaformat:google-java-format</groupArtifact>
</googleJavaFormat>
```
Expand Down

0 comments on commit 5aab9d9

Please sign in to comment.