File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
buildSrc/src/main/java/org/springframework/gradle/maven Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
package org .springframework .gradle .maven ;
2
2
3
+ import io .spring .gradle .propdeps .PropDepsPlugin ;
3
4
import org .gradle .api .Action ;
4
5
import org .gradle .api .Plugin ;
5
6
import org .gradle .api .Project ;
7
+ import org .gradle .api .component .AdhocComponentWithVariants ;
8
+ import org .gradle .api .plugins .JavaBasePlugin ;
6
9
import org .gradle .api .plugins .JavaPlugin ;
7
10
import org .gradle .api .plugins .JavaPluginExtension ;
8
11
import org .gradle .api .publish .PublishingExtension ;
15
18
import org .gradle .api .publish .maven .MavenPublication ;
16
19
import org .gradle .api .publish .maven .plugins .MavenPublishPlugin ;
17
20
21
+ import java .util .function .Consumer ;
22
+
18
23
public class MavenPublishingConventionsPlugin implements Plugin <Project > {
19
24
@ Override
20
25
public void apply (Project project ) {
@@ -27,6 +32,13 @@ public void execute(MavenPublishPlugin mavenPublish) {
27
32
MavenPublishingConventionsPlugin .this .customizeJavaPlugin (project );
28
33
}
29
34
});
35
+ project .getPlugins ().withType (PropDepsPlugin .class ).forEach (new Consumer <PropDepsPlugin >() {
36
+ @ Override
37
+ public void accept (PropDepsPlugin plugin ) {
38
+ AdhocComponentWithVariants component = (AdhocComponentWithVariants ) project .getComponents ().findByName ("java" );
39
+ component .addVariantsFromConfiguration (project .getConfigurations ().getByName ("optional" ), (details ) -> details .mapToOptional ());
40
+ }
41
+ });
30
42
}
31
43
32
44
private void customizePom (MavenPom pom , Project project ) {
You can’t perform that action at this time.
0 commit comments