File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/main/java/org/openrewrite/gradle Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 24
24
import org .gradle .api .Plugin ;
25
25
import org .gradle .api .Project ;
26
26
import org .gradle .api .artifacts .Configuration ;
27
+ import org .gradle .api .artifacts .ConfigurationContainer ;
27
28
import org .gradle .api .artifacts .ResolvedDependency ;
28
29
import org .gradle .api .plugins .JavaBasePlugin ;
29
30
import org .gradle .api .publish .PublishingExtension ;
@@ -64,9 +65,16 @@ public void apply(Project project) {
64
65
.findByName ("nebula" ));
65
66
});
66
67
67
- Configuration provided = project .getConfigurations ().create ("provided" );
68
- project .getConfigurations ().named ("compileOnly" , compileOnly -> compileOnly .extendsFrom (provided ));
69
- project .getConfigurations ().named ("testImplementation" , testImplementation -> testImplementation .extendsFrom (provided ));
68
+ ConfigurationContainer configurations = project .getConfigurations ();
69
+ Configuration provided = configurations .create ("provided" );
70
+ Configuration compileOnly = configurations .findByName ("compileOnly" );
71
+ if (compileOnly != null ) {
72
+ compileOnly .extendsFrom (provided );
73
+ }
74
+ Configuration testImplementation = configurations .findByName ("testImplementation" );
75
+ if (testImplementation != null ) {
76
+ testImplementation .extendsFrom (provided );
77
+ }
70
78
71
79
project .getExtensions ().configure (PublishingExtension .class , ext ->
72
80
ext .getPublications ().named ("nebula" , MavenPublication .class , pub -> {
You can’t perform that action at this time.
0 commit comments