Is there a maven plugin which automatically calculates and updates serial version uid for all java class files implementing the Serializable interface?
File -> Settings -> Editor -> Inspections -> Java -> Serialization issues : Find serialization class without serialVersionUID and check it. Back to the editor, clicks on the class name, ALT + ENTER (Windows), it will prompts the Add serialVersionUID field option. A new serialVersionUID is auto-generated.
You can generate SerialVersionUID in intellij by pressing ctrl + shift +A (find action) and then typing Serializable class without serialVersionUID and toggle it from Off to On.
Simply put, we use the serialVersionUID attribute to remember versions of a Serializable class to verify that a loaded class and the serialized object are compatible. The serialVersionUID attributes of different classes are independent. Therefore, it is not necessary for different classes to have unique values.
The serialization at runtime associates with each serializable class a version number called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization.
A Maven module named maven-svuid-plugin is available to do what you want. Please look at https://bitbucket.org/lp/maven-svuid-plugin/wiki/Home
I don't know of any Maven plugin that can add this functionality, but you could call the Serialver Ant task using the Maven AntRun Plugin in the process-sources
phase of the lifecycle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With