You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The maven-publish plugin will create a separate task (named publishMavenJavaPublicationToMavenRepository by default) for each publication. This task actually published the artifact. The publish task itself does nothing, it's purpose is to have all those publishing tasks as dependnecies.
Using the shown example from the MDK, both the publishMavenJavaPublicationToMavenRepositoryand the reobfJar task will become dependencies of the publish task. When executing publish, it can happen, that publishMavenJavaPublicationToMavenRepository runs beforereobfJar, publishing a deobfuscated jar file to the maven repository.
The correct way to specify that the the reobfJar task should run before the publication, is to use the builtBy method of PublicationArtifact like this:
publishing {
publications {
mavenJava(MavenPublication) {
// All the other configuration of the publication
artifact(jar) {
builtBy project.provider { project.tasks.named('reobfJar') }
}
}
}
}
I think, the MDK should direct the modder to this approach or at least not show an example that does not work and publishes deobfuscated jars into the maven.
The text was updated successfully, but these errors were encountered:
noeppi-noeppi
added
the
Triage
This request requires the active attention of the Triage Team. Requires labelling or reviews.
label
Jun 27, 2023
Description of issue:
The MDK shows the following example on how to delay the reobfuscation of the jar file (by the
reobfJar
) task:The
maven-publish
plugin will create a separate task (namedpublishMavenJavaPublicationToMavenRepository
by default) for each publication. This task actually published the artifact. Thepublish
task itself does nothing, it's purpose is to have all those publishing tasks as dependnecies.Using the shown example from the MDK, both the
publishMavenJavaPublicationToMavenRepository
and thereobfJar
task will become dependencies of thepublish
task. When executingpublish
, it can happen, thatpublishMavenJavaPublicationToMavenRepository
runs beforereobfJar
, publishing a deobfuscated jar file to the maven repository.The correct way to specify that the the
reobfJar
task should run before the publication, is to use thebuiltBy
method ofPublicationArtifact
like this:I think, the MDK should direct the modder to this approach or at least not show an example that does not work and publishes deobfuscated jars into the maven.
The text was updated successfully, but these errors were encountered: