
us.springett.maven.uuidgenerator.MavenUuidGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-uuid-generator Show documentation
Show all versions of maven-uuid-generator Show documentation
Generates a UUID during each build and assigns the value to project.build.uuid
The newest version!
package us.springett.maven.uuidgenerator;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import java.util.UUID;
@Mojo(
name = "generate",
defaultPhase = LifecyclePhase.INITIALIZE
)
public class MavenUuidGenerator extends AbstractMojo {
@Parameter(property = "project", readonly = true, required = true)
private MavenProject project;
@Override
public void execute() throws MojoExecutionException {
final String uuid = UUID.randomUUID().toString();
project.getProperties().setProperty("project.build.uuid", uuid);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy