Skip to content

Commit 9a1cef4

Browse files
committed
Spotless dependencies are now resolved from the normal repositories of the root project.
1 parent f9d66c4 commit 9a1cef4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

plugin-gradle/CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).
44

55
## [Unreleased]
6+
### Changed
7+
* **BREAKING** Previously, many projects required `buildscript { repositories { mavenCentral() }}` at the top of their root project, because Spotless resolved its dependencies using the buildscript repositories. Spotless now resolves its dependencies from the normal project repositories of the root project, which means that you can remove the `buildscript {}` block, but you still need `repositories { mavenCentral() }` (or similar) in the root project.
68

79
## [5.17.1] - 2021-10-26
810
### Changed

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static Provisioner fromRootBuildscript(Project project) {
7373
Objects.requireNonNull(project);
7474
return (withTransitives, mavenCoords) -> {
7575
try {
76-
Configuration config = project.getRootProject().getBuildscript().getConfigurations().create("spotless"
76+
Configuration config = project.getRootProject().getConfigurations().create("spotless"
7777
+ new Request(withTransitives, mavenCoords).hashCode());
7878
mavenCoords.stream()
7979
.map(project.getBuildscript().getDependencies()::create)
@@ -85,7 +85,7 @@ static Provisioner fromRootBuildscript(Project project) {
8585
logger.log(
8686
Level.SEVERE,
8787
"You probably need to add a repository containing the '" + mavenCoords + "' artifact in the 'build.gradle' of your root project.\n" +
88-
"E.g.: 'buildscript { repositories { mavenCentral() }}'",
88+
"E.g.: 'repositories { mavenCentral() }'",
8989
e);
9090
throw e;
9191
}
@@ -125,7 +125,7 @@ public boolean equals(Object obj) {
125125
public String toString() {
126126
String coords = mavenCoords.toString();
127127
StringBuilder builder = new StringBuilder();
128-
builder.append(coords.substring(1, coords.length() - 1)); // strip off []
128+
builder.append(coords, 1, coords.length() - 1); // strip off []
129129
if (withTransitives) {
130130
builder.append(" with transitives");
131131
} else {

0 commit comments

Comments
 (0)