Closed GeorgeV220 closed 3 months ago
Which kind of output task artifact do you mean? The tasks of type DowngradeJar are a subtype of the Jar
task and thus can be used like any other jar output task
for example to publish a shadow jar I do this:
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
artifactId = project.getName().toLowerCase() + "-shade"
groupId = ((String) project.getGroup()).toLowerCase() + "-shade"
artifact sourcesJar
artifact javadocJar
}
}
}
also is possible to downgrade a shadow jar output ?
Well what kind of publishing do you want to perform? Do you want to publish the downgraded jar as the main variant or as an additional variant or do you just want to publish it as a different classifier but otherwise like an ordinary jar under the main variant?
You can define the input jar through https://github.com/unimined/JvmDowngrader/blob/lts/gradle-plugin/src/main/kotlin/xyz/wagyourtail/jvmdg/gradle/task/DowngradeJar.kt#L52 - so you'd just set the output jar of the shadowjar task to be the input jar of the DowngradeJar task. The examples provided in this repo's readme should be helpful enough.
On advice on how you can setup variant publishing you could consult the readme of https://github.com/stianloader/interjava, but please only do that if you know what you are doing (at which point you wouldn't need to hear all this in the first place I guess).
Actually with the links you provided I think I'm okay!! I'll read them more carefully. Thank you very much for your help, I appreciate it!!
Just beware that interjava is not the jvmDowngrader gradle plugin (it just happens to do the same thing. That being said it's outdated and not maintained by me anymore so I'd still not use it. The readme might still be a bit of use though, which is why I linked it).
How to get the output task artifact in order to publish it to maven repository ?