Package org.jboss.gm.common.utils
Class ProjectUtils
- java.lang.Object
-
- org.jboss.gm.common.utils.ProjectUtils
-
public final class ProjectUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getArchivesBaseName(org.gradle.api.Project project)
This returns the value of archivesBaseName while not returning its default value of project.name archiveTask.archiveBaseName defaults to the project.archivesBaseName which defaults to project.name.static java.lang.String
getRealGroupId(org.gradle.api.Project project)
Gradle annoyingly sets a default group using the following code:static void
updateNameField(org.gradle.api.Project project, java.lang.Object replacement)
The Project name field is private and therefore can't be dynamically updated.
-
-
-
Method Detail
-
getRealGroupId
public static java.lang.String getRealGroupId(org.gradle.api.Project project)
Gradle annoyingly sets a default group using the following code:public Object getGroup() { if (group != null) { return group; } else if (this == rootProject) { return ""; } group = rootProject.getName() + (getParent() == rootProject ? "" : "." + getParent().getPath().substring(1).replace(':', '.')); return group;
We therefore need to reverse that when determining the group for the model as otherwise we could end up with incorrect values which are assumed to be a Maven groupId.- Parameters:
project
- the current project- Returns:
- the group equivalent to a Maven groupId or empty
-
updateNameField
public static void updateNameField(org.gradle.api.Project project, java.lang.Object replacement)
The Project name field is private and therefore can't be dynamically updated.- Parameters:
project
- the current projectreplacement
- the new name to use
-
getArchivesBaseName
public static java.lang.String getArchivesBaseName(org.gradle.api.Project project)
This returns the value of archivesBaseName while not returning its default value of project.name archiveTask.archiveBaseName defaults to the project.archivesBaseName which defaults to project.name. References: https://docs.gradle.org/current/userguide/maven_plugin.html https://docs.gradle.org/6.8.1/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html- Parameters:
project
- the current project- Returns:
- the value for the archivesBaseName or null if not set
-
-