Closed voidpointer0x00 closed 2 months ago
Should now be fixed with the latest 1.6 build, let me know if there are still any problems 👍
Should now be fixed with the latest 1.6 build, let me know if there are still any problems 👍
Then I reverted to split sources, confirmed that -sources jars were published, but they were not recognized by IDEs. And only now I got my hands on looking into it :rofl:
So the problem seems to be that it publishes -sources jar identical to the regular with .class files. Also javadocs are ignored when publishing, maybe related?
md5 comparison of local build files to the files in maven repo 1) with split sources, 2) sources merged without loom's splitEnvironmentSourceSets
:
# maven repo
9a0e810d8cb35e54365ba9d0f4e4dff5 demo-actions-1.1.4.jar
9a0e810d8cb35e54365ba9d0f4e4dff5 demo-actions-1.1.4-sources.jar # contains .class files
# local build files
9a0e810d8cb35e54365ba9d0f4e4dff5 build/libs/demo-actions-1.20.1-1.1.4.jar
b7f885ad473af2ce5e87cf5eb181f382 build/libs/demo-actions-1.20.1-1.1.4-sources.jar # contains .java files
# merged sources, works as intended; maven repo:
ef322d9e98d986b899f885afe44464be demo-actions-1.1.5.jar
e65e318665c6d9887de8f6509deffb19 demo-actions-1.1.5-sources.jar
# local build files:
ef322d9e98d986b899f885afe44464be build/libs/demo-actions-1.20.1-1.1.5.jar
1b9fa928e0c3f0d162462a295784c30b build/libs/demo-actions-1.20.1-1.1.5-javadoc.jar # not published?
e65e318665c6d9887de8f6509deffb19 build/libs/demo-actions-1.20.1-1.1.5-sources.jar
Fixed again 👍
The
gradle publish
(bothpublishToMavenLocal
andpublishAllPublicationsToMavenRepository
) does not publish generated sources jar when usingsplitEnvironmentSourceSets()
. Though it does publish javadocs.Full config (without some dependencies and repositories)
```groovy plugins { id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' id 'io.freefair.lombok' version '8.6' id 'com.google.protobuf' version '0.9.4' } version = project.mod_version group = project.maven_group base { archivesName = "${project.archives_base_name}-${project.minecraft_version}" } loom { splitEnvironmentSourceSets() mods { "demo-actions" { sourceSet sourceSets.main sourceSet sourceSets.client } } } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings loom.officialMojangMappings() modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" } processResources { inputs.property "version", project.version filesMatching("fabric.mod.json") { expand "version": project.version } } tasks.withType(JavaCompile).configureEach { it.options.release = 21 } java { withSourcesJar() withJavadocJar() sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } publishing { publications { mavenJava(MavenPublication) { from components.java } } repositories { maven { url 'hidden' credentials { /* hidden */ } } } } ```Removing the loom section and merging server & source code together makes
-sources.jar
publication possible, but it is definitely not a fix :DIt looks like it just skips source generation on publishing
With source sets merged: