When working on Spring Boot projects – JPA, JDBC, or RESTful API, we sometimes encounter the error IntelliJ Maven Malformed \uxxxx encoding in Windows 10. The chances of this error popping up is very high when we work on multiple Maven projects. Not to mention when we frequently switch between versions.
When Does The Maven Malformed \uxxxx Encoding Error Happen in IntelliJ?
The error prevents us from building our codebase locally. It can happen when we pull new changes from Git, and the IDE automatically runs Apache Maven in the background. Imagine when we need to refresh multiple projects. Therefore, when this error happens, it could be a blocker for developers, and they would waste their time trying to figure the error out.
To fix this Maven Malformed \uxxxx encoding error, we could delete the content of our local .m2 directory. However, that solution is not the answer unless we incidentally want to clean up our machine to save disk space. Deleting the .m2 local directory may increase our downtime because we need to download all the dependencies again, which may take a lot more time.
How To Fix This Malformed \uxxxx Encoding Error
The alternative solution is to search for .properties files with “\u” text. We could use Notepad++ and perform a file search in the .m2 directory. For instance, consider the following find that causes the Malformed \uxxxx encoding error.
When we open one of the affected files, we get the following screenshot.
Then, we need to delete the corrupted entries from all the affected files.
The Permanent Solution – Sort Of
To permanently fix the Maven Malformed \uxxxx encoding error, we can configure IntelliJ with an external Apache Maven. It would be better to use an external Apache Maven whose version is higher than what is available in IntelliJ out-of-the-box.
For example, we can replace Apache Maven 3.8.1 (which comes with IntelliJ) with Apache Maven 3.8.6
So, do not delete the .m2 directory for this kind of error. Just pluck those corrupted entries from affected .properties files.