Setting project is also getting uploaded

I have added the upload task to my init.gradle

uploadArchives {
 repositories {
  mavenDeployer { repository(url: "file:D:\gradle-repo") }

I have a root project with a settings.gradle and two sub projects

 settings.gradle ( this includes project1 and project2 )

When I try to build and upload project1 and project2 individually it works. But when i try to run the gradle upload from rootProject ,I get the below error

Could not publish configuration ‘archives’

For artifact {:rootproject:unspecified:jar}: The groupId cannot be empty.

What I observed was that the gradle was trying to publish the root project also and it could not get the version and group Id.

When i move the uploadArchives task out of the init.gradle and add it within subprojects of the settings.gradle , then it works fine.

Is there some setting to be done to exclude root project from getting uploaded ?

I was able to solve this problem by removing the

apply plugin 'groovy'

from the init.gradle.

Can you please explain why does this force the settings project to get uploaded ?

It wires in a Jar to be published. That java plugin does the same.

right - i had to remove " apply java plugin " also from init.gradle.

I will move these plugins from init.gradle to individual project settings.