How to generate serialVersionUID for all classes in a project


We are migrating from Java 8 to Java 11 and are seeing many InvalidClassExceptions at run time that indicate the serialVersionUID is not compatible.

Is there a way in IDEA to generate the serialVersionUID for all classes that don't explicitly define it already?


You can do Code | Inspect Code with the inspection enabled ( and then apply a fix to the inspection results.


I had done that.  However, I was looking at the results from the JVM languages, which doesn't have a quick fix.  The Java section does however, which I hadn't seen.

Thanks for the quick response.


I used the quick fix for the Java section inspection and reran the JVM Languages inspection expecting it to have reduced results.  It didn't reduce results and apparently found many other classes without serialVersionUID. 

The inspection in the JVM Languages is the one described by mkyong in the link you provided.  It also does not have a quick fix.

Was this changed in IDEA since mkyong posted?  I am running IDEA 2021.3.2


When I say there is no quick fix, I mean there isn't a button on the inspection results for the JVM Language inspection that will correct all the issues like there was for the Java inspection.  IDEA has the warning in each class and it can be selected to generate a serialVersionUID, but each class needs to be opened.  With over 6000 results, opening each class and selecting the warning is not feasible


Hello, there is an option to apply the fixes for all the classes in the file where the inspection triggers:

but unfortunately there is no option to make it for all the classes in the project. Please feel free to create a feature request for this tool at the YouTrack:

Thank you