java.lang.IllegalArgumentException: Malformed \uxxxx encoding while mvn install

We Are Going To Discuss About java.lang.IllegalArgumentException: Malformed \uxxxx encoding while mvn install. So lets Start this Java Article.

java.lang.IllegalArgumentException: Malformed \uxxxx encoding while mvn install

Advertisements
  1. java.lang.IllegalArgumentException: Malformed \uxxxx encoding while mvn install

    For me it turned out to be a corrupted dependency as well.
    I did not want to go through the process of setting up the debugger, so decided to look for files containing \u0000 in my ~/.m2 directory by running:
    grep -rnw ~/.m2 -e '\u0000'For me it turned out to be a corrupted dependency as well.
    I did not want to go through the process of setting up the debugger, so decided to look for files containing \u0000 in my ~/.m2 directory by running:
    grep -rnw ~/.m2 -e '\u0000'

  2. java.lang.IllegalArgumentException: Malformed \uxxxx encoding while mvn install

    For me it turned out to be a corrupted dependency as well.
    I did not want to go through the process of setting up the debugger, so decided to look for files containing \u0000 in my ~/.m2 directory by running:
    grep -rnw ~/.m2 -e '\u0000'

Solution 1

Advertisements

For me it turned out to be a corrupted dependency as well.
I did not want to go through the process of setting up the debugger, so decided to look for files containing \u0000 in my ~/.m2 directory by running:

grep -rnw ~/.m2 -e '\u0000'

Original Author Of This Content

Solution 2

Advertisements

To find which file is malformed (as to not have to delete your entire Maven repository) you can debug it like so:

  1. Add a breakpoint to the relevant line in java.util.Properties (as detailed in the error stack trace) and then run any Maven action in debug mode.

enter image description here

  1. When the code hits that breakpoint, find and select TrackingFileManager.read(File) in the call stack.

enter image description here

  1. Now find path of the file that caused the issue.

enter image description here

  1. The file is indeed malformed… Delete the file (and Maven will re-download it during the next action).

enter image description here

  1. The correct file (after having been deleted and re-downloaded):

enter image description here

Original Author Of This Content

Solution 3

Advertisements

In my case the problem was in the 3rd party library, incorrect charаcters somehow were saved to the resolver-status.properties file (example of incorrect line: maven-metadata-nexus-releases.xml.lastUpda\u0000\u0000\....) which is located under the ~/.m2/repository/path-to-the-library. Just removed the folder with the library and rebuilt the project.

Original Author Of This Content

Solution 4

Advertisements

I removed all artifacts from my ~/.m2 directory and re-ran mvn build.
This time, build succeeded!

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment