jlesquembre / clj-nix

Nix helpers for Clojure projects
https://jlesquembre.github.io/clj-nix/
Eclipse Public License 2.0
146 stars 22 forks source link

Parser Exception when downloading certain dependencies via `deps-lock` #15

Closed neshtea closed 2 years ago

neshtea commented 2 years ago

I was trying out the latest version of clj-nix (again, thanks for your work on this!) and found error that did not occur with the last version of deps-lock (or on the next branch, that is).

Description

Certain types of depdenencies will make deps-lock throw a XmlPullParserException. This means that no deps-lock.edn will be generated.

Example/Reproduce

Given this deps.edn file

{:deps {javax.activation/javax.activation-api {:mvn/version "1.2.0"}}}

running nix run github:jlesquembre/nix-clj#deps-lock will result in the following error output:

$ nix run github:jlesquembre/clj-nix#deps-lock
Processing /home/<user>/<project-dir>/deps.edn without aliases
Execution error (XmlPullParserException) at org.codehaus.plexus.util.xml.pull.MXParser/parseXmlDeclWithVersion (MXParser.java:3366).
UTF-8 BOM plus xml decl of iso-8859-1 is incompatible (position: START_DOCUMENT seen <?xml version="1.0" encoding="iso-8859-1"... @1:41) 

Full report at:
/tmp/clojure-<int>.edn

I am not sure what causes it, this is just one example of a library that provokes the error. I guess it has something to do with the kind of dependency (as described here) with dependencies that require a specific :deps/manifest (like :pom or :deps, which must be specified manually according to the docs).

jlesquembre commented 2 years ago

good catch, and great example, thanks for reporting it. I found the reason, the pom.xml for that dependency uses a different encoding, I didn't consider that case, I'm submitting a fix