@@ -60,7 +60,7 @@ public Set<File> provisionWithTransitives(boolean withTransitives, Collection<St
60
60
if (result != null ) {
61
61
return result ;
62
62
} else {
63
- result = GradleProvisioner .fromRootBuildscript (rootProject ).provisionWithTransitives (req .withTransitives , req .mavenCoords );
63
+ result = GradleProvisioner .forProject (rootProject ).provisionWithTransitives (req .withTransitives , req .mavenCoords );
64
64
cache .put (req , result );
65
65
return result ;
66
66
}
@@ -69,22 +69,23 @@ public Set<File> provisionWithTransitives(boolean withTransitives, Collection<St
69
69
}
70
70
}
71
71
72
- static Provisioner fromRootBuildscript (Project project ) {
72
+ static Provisioner forProject (Project project ) {
73
73
Objects .requireNonNull (project );
74
74
return (withTransitives , mavenCoords ) -> {
75
75
try {
76
- Configuration config = project .getRootProject (). getConfigurations ().create ("spotless"
76
+ Configuration config = project .getConfigurations ().create ("spotless"
77
77
+ new Request (withTransitives , mavenCoords ).hashCode ());
78
78
mavenCoords .stream ()
79
- .map (project .getBuildscript (). getDependencies ()::create )
79
+ .map (project .getDependencies ()::create )
80
80
.forEach (config .getDependencies ()::add );
81
81
config .setDescription (mavenCoords .toString ());
82
82
config .setTransitive (withTransitives );
83
83
return config .resolve ();
84
84
} catch (Exception e ) {
85
+ String projName = project .getPath ();
85
86
logger .log (
86
87
Level .SEVERE ,
87
- "You probably need to add a repository containing the '" + mavenCoords + "' artifact in the 'build.gradle' of your root project.\n " +
88
+ "You probably need to add a repository containing the '" + mavenCoords + "' artifact in the 'build.gradle' of the " + projName + " project.\n " +
88
89
"E.g.: 'repositories { mavenCentral() }'" ,
89
90
e );
90
91
throw e ;
0 commit comments