First of all, if your set up requires something called "group name", you probably should provide a meaningful value. If it has to be unique, you can append some generated characters, like "MyApplication-10937410". Also, using a UUID seems to me like using a sledge-hammer to crack a nut. But this is independent of your actual problem, so here is the solution I propose:
If you have not already done so, create a maven plugin (there's an archetype for that). Add this dependency:
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
</dependency>
This is how your MOJO should look like:
/**
* Goal which generates a group name.
*
* @goal generate
* @phase initialize
*/
public class GroupNameGeneratorMojo extends AbstractMojo {
/**
* @parameter expression="${project}"
* @required
* @readonly
*/
private MavenProject project;
@Override
public void execute() throws MojoExecutionException {
String groupName = ... ;
project.getProperties().setProperty("uniqueGroupName", groupName);
}
}
In your actual projects pom, use ${uniqueGroupName}
whereever you need it and configure your plugin like this
<build>
<plugins>
<plugin>
<groupId>the.plugin.groupid</groupId>
<artifactId>groupNameGenerator</artifactId>
<executions>
<execution>
<goals><goal>generate</goal></goals>
</execution>
</executions>
<plugin>