I need to set a property in maven pom.xml file which should be a UUID. Can anybody tell me
what is the best possible way to set a property to UUID?
I am using a profile which launch the gigaspaces and gigaspaces requires group name which I
want to be unique(uuid). So, in my profile I want to set a groupName property value which
should change for each build. I wrote a UUIDGenerator plugin myself as I didn’t found any.
So, I am looking How can this be achieved? Is writing a plugin better option or there is an
easier option.
Thanks,
Shekhar
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:
This is how your MOJO should look like:
In your actual projects pom, use
${uniqueGroupName}whereever you need it and configure your plugin like this