gradle-nexus / publish-plugin

Gradle plugin for publishing to Nexus repositories
Apache License 2.0
406 stars 29 forks source link

Where should group/version be specified in a multi-project setup? #150

Open Whathecode opened 2 years ago

Whathecode commented 2 years ago

I just changed my project from a single module to a multiple module project. It is a requirement that the Gradle Plugin is applied on the root project.

But, seemingly things go wrong if group and version is not specified on the root project. If group is not specified on the root project I get the following warning:

Failed to find staging profile for package group:

If version is not specified, I get a bad request.

Received status code 400 from server: Bad Request

Things seem to work if the version is set to the same version on the root project than on the sub projects I'm trying to publish. This is also seemingly what is done in the multi-project example project: version is set both in the buildSrc plugin, and again in the root project.

I can't follow the logic here. Why does group and version need to be set on the root project? What if I want to version subprojects independently?

dekalo-stanislav commented 2 years ago

I have this same issue, would be nice to have an example for multimodule publishing. Like publishing two separate libraries from the same repository.

dekalo-stanislav commented 2 years ago

Got the answer today, you can define it elsewhere in the project and later use it from all places that you need.

Here is a working example with working publishing https://github.com/heershingenmosiken/assertions-android.

gradle.properties contains assertionSdkGroup={yourGroupId} and then it is used in build.gradle as group = assertionSdkGroup assertions-sdk.gradle file as groupId assertionSdkGroup and in assertions-android-sdk.gradle as dependencyNode.appendNode('groupId', assertionSdkGroup)

dekalo-stanislav commented 2 years ago

hope this will help you, at least my question is solved.