unimined / JvmDowngrader

Downgrades modern java bytecode to older versions. at either compile or runtime.
https://jvmdowngrader.wagyourtail.xyz
Other
48 stars 5 forks source link

Publish downgradeJar output to maven repository #2

Closed GeorgeV220 closed 3 months ago

GeorgeV220 commented 3 months ago

How to get the output task artifact in order to publish it to maven repository ?

Geolykt commented 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

GeorgeV220 commented 3 months ago

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 ?

Geolykt commented 3 months ago

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).

GeorgeV220 commented 3 months ago

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!!

Geolykt commented 3 months ago

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).