@@ -22,18 +22,18 @@ java {
22
22
}
23
23
24
24
configurations {
25
- shadow
26
- shadow . extendsFrom(implementation)
25
+ include
26
+ include . extendsFrom(implementation)
27
27
}
28
28
29
29
dependencies {
30
30
implementation project(" :api" )
31
31
implementation " info.picocli:picocli:$picocli_version "
32
32
implementation ' org.slf4j:slf4j-simple:2.0.13'
33
33
34
- shadow project(" :parchment" )
35
- shadow project(" :accesstransformers" )
36
- shadow project(' :interfaceinjection' )
34
+ include project(" :parchment" )
35
+ include project(" :accesstransformers" )
36
+ include project(' :interfaceinjection' )
37
37
38
38
testImplementation platform(" org.junit:junit-bom:$junit_version " )
39
39
testImplementation ' org.junit.jupiter:junit-jupiter'
45
45
}
46
46
47
47
shadowJar {
48
- configurations = [project. configurations. shadow ]
48
+ configurations = [project. configurations. include ]
49
49
mergeServiceFiles()
50
50
}
51
51
@@ -58,6 +58,24 @@ components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElemen
58
58
skip()
59
59
}
60
60
61
+ abstract class ComponentMaker {
62
+ @Inject
63
+ abstract SoftwareComponentFactory getFactory ()
64
+ }
65
+
66
+ final componentFactory = objects. newInstance(ComponentMaker ). factory
67
+
68
+ final shadowComponent = componentFactory. adhoc(" shadow" )
69
+ project. components. add(shadowComponent)
70
+
71
+ tasks. named(' shadowJar' , Jar ) {
72
+ archiveClassifier = ' '
73
+ archiveBaseName = ' jst-cli-bundle'
74
+ }
75
+
76
+ shadowComponent. addVariantsFromConfiguration(configurations. shadowRuntimeElements) {
77
+ it. mapToMavenScope(" runtime" )
78
+ }
61
79
tasks. register(' sourcesBundleJar' , Jar ) {
62
80
it. archiveClassifier = ' sources'
63
81
it. archiveBaseName = ' jst-cli-bundle'
@@ -86,7 +104,7 @@ publishing {
86
104
create(' bundle' , MavenPublication ) {
87
105
artifactId = ' jst-cli-bundle'
88
106
89
- project . shadow. component(bundle)
107
+ from components . shadow
90
108
artifact(tasks. sourcesBundleJar)
91
109
artifact(tasks. javadocBundleJar)
92
110
0 commit comments