@@ -183,6 +183,13 @@ tasks {
183
183
}
184
184
}
185
185
186
+ val javaOnlySourcesJar by creating(Jar ::class ) {
187
+ from(kotlin.sourceSets[" jvmMain" ].kotlin) {
188
+ into(" ." )
189
+ }
190
+ archiveClassifier.set(" sources" )
191
+ }
192
+
186
193
val allMetadataJar by existing(Jar ::class ) {
187
194
archiveClassifier.set(" common" )
188
195
}
@@ -203,6 +210,10 @@ nexusPublishing {
203
210
}
204
211
205
212
configurations {
213
+ create(" javaOnlySourcesElements" ) {
214
+ copyAttributes(configurations.findByName(" jvmSourcesElements" )!! .attributes, attributes)
215
+ }
216
+
206
217
create(" javadocElements" ) {
207
218
attributes {
208
219
attribute(Category .CATEGORY_ATTRIBUTE , project.objects.named(Category ::class .java, Category .DOCUMENTATION ))
@@ -214,6 +225,7 @@ configurations {
214
225
}
215
226
216
227
artifacts {
228
+ add(" javaOnlySourcesElements" , tasks.getByName(" javaOnlySourcesJar" ))
217
229
add(" javadocElements" , tasks.getByName(" javadocJar" ))
218
230
}
219
231
@@ -244,7 +256,7 @@ publishing {
244
256
variant(" jvmRuntimeElements" ) {
245
257
configureVariantDetails { mapToMavenScope(" runtime" ) }
246
258
}
247
- variant(" jvmSourcesElements " )
259
+ variant(" javaOnlySourcesElements " )
248
260
variant(" javadocElements" )
249
261
}
250
262
val targetModules = kotlin.targets.filter { it.targetName != " jvm" && it.targetName != " metadata" }.map { target ->
0 commit comments