Reputation: 62519
check build.gradle and there is a variable from project itself called "group". In the code i inherited its set to the application id but what is group used for ?
the gradle documentation it states:
void setGroup(Object group) Sets the group of this project.
UPDATE: From what i can tell from here it looks like groups are for grouping tasks together.
Upvotes: 18
Views: 12592
Reputation: 2092
@Peter Ledbrook answer is correct to original question. As I can't edit above answer I will write standalone one to answer @Faraz and provide some additional context.
Following is the explanation of how to print the project group in the task itself.
Group property is assigned to the project. So first you have to access project instance from the task. Then you access direct group property of the project. Don't confuse it with the group property of the task, which has another semantic and is used to group Gradle properties into categories of specific task to easier navigate them.
In the task itself you can print the property with simple string interpolation that is supported by Groovy syntax.
Example task that prints project group property.
group 'com.rivancic.project.group'
task printProjectGroup {
doLast {
logger.info("Project group in which task is being executed: ${project.group}")
}
}
Upvotes: 0
Reputation: 4462
The group is effectively a namespace for identifying the artifact or artifacts produced by a build. As an example, when you have a dependency like this:
dependencies {
compile 'org.hibernate:hibernate-core:3.6.7.Final'
}
The org.hibernate
is the group (or groupId in Maven parlance). So if your build produces a JAR file that is published to a repository, it is published under the group you specify in the build file:
group = "org.example"
I don't know if the group makes much sense outside of publishing artifacts. I only ever use it for JAR libraries.
Upvotes: 30