Harold L. Brown
Harold L. Brown

Reputation: 9956

Maven writes \u0000 into resolver-status.properties files, failing subsequent builds

I am using MacOS and I am using Maven in version 3.8.7. I am using Java in 11.0.17 by Eclipse Temurin.

Somehow, when building a big Maven project, Maven creates resolver-status.properties files that contain invalid characters:

.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:3:\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:4:maven-metadata-willhaben-ne\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:8:maven-metadata-shibboleth-\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=

A subsequent Maven build is then failing with this error message:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.281 s
[INFO] Finished at: 2023-01-17T09:19:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Malformed \uxxxx encoding.
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

The error is happening when I run Maven both with one thread and with multiple threads.

How can I fix my build so that Maven no longer writes \u0000 in resolver-status.properties files?

Upvotes: 1

Views: 1682

Answers (2)

Harold L. Brown
Harold L. Brown

Reputation: 9956

I now suspect that the broken files get downloaded from Nexus when performing the Maven build anew.

On our CI they are built with a somewhat older Maven version and with multiple threads.

Upvotes: 0

Abhishek Tiwari
Abhishek Tiwari

Reputation: 1

Use this command to remove all those files having \u0000 quickly from your m2 repository

find  ~/.m2 -name "resolver-status.properties" -exec grep -H -e '\u0000' {} \; | sed -r 's/:.*$//g' | xargs rm

Upvotes: 0

Related Questions