Skip to content

Adds a variants from configuration#137

Closed
yannicklamprecht wants to merge 1 commit into
PaperMC:mainfrom
yannicklamprecht:task/add-reobfjar-to-variants-config-when-publish-to-maven-local-task-is-present
Closed

Adds a variants from configuration#137
yannicklamprecht wants to merge 1 commit into
PaperMC:mainfrom
yannicklamprecht:task/add-reobfjar-to-variants-config-when-publish-to-maven-local-task-is-present

Conversation

@yannicklamprecht
Copy link
Copy Markdown

When maven publish plugin is present on userdev projects
a normal publish results into a wrong module file in maven repository.

This commit adds the missing reobfuscated jars to this module file.

The initial issue is that depending on the reobfuscated plugin dependency results into loading the dev dependency because no reobfuscated one is defined in the module file.

Example:
before that change: https://eldonexus.de/repository/maven-releases/com/github/yannicklamprecht/worldborderapi/1.181.1/worldborderapi-1.181.1.module
after that change: https://eldonexus.de/repository/maven-releases/com/github/yannicklamprecht/worldborderapi/1.181.2/worldborderapi-1.181.2.module

The diffs are the missing files in the two variants: apiElements and runtimeElements

When maven publish plugin is present on userdev projects
a normal publish results into a wrong module file in maven repository.

This commit adds the missing reobfuscated jars to this module file.
electronicboy
electronicboy previously approved these changes Mar 9, 2022
@jpenilla
Copy link
Copy Markdown
Member

jpenilla commented Jan 31, 2023

This isn't the correct approach, for now, you can use this to publish the reobf jar under its own classifier (which dependants would need to specify):

publishing {
	publications {
		register<MavenPublication>("maven") {
			from(components["java"])
			artifact(tasks.reobfJar) {
				classifier = "reobf"
			}
		}
	}
}

If you want reobf to be selected automatically you would need to remove the java components line, due to how Gradle selects variants. After #177, something better can be worked on for publishing.

@jpenilla jpenilla closed this Jan 31, 2023
@yannicklamprecht yannicklamprecht deleted the task/add-reobfjar-to-variants-config-when-publish-to-maven-local-task-is-present branch January 31, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants