boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 181 forks source link

Set user agent on Maven download requests #700

Open danielcompton opened 6 years ago

danielcompton commented 6 years ago

Problem Description

Currently Boot doesn't set a User Agent for Aether to use when it is downloading files. Therefore, Aether uses the default User-Agent header Aether. It would be useful for Boot to set a User-Agent header to enable Maven repository owners and corporate users with middleware proxies to help debug any issues that arise.

You can set this by setting the system property aether.connector.userAgent:

Prior art

Leiningen does it like this:

https://github.com/technomancy/leiningen/blob/cc44d42ff6382be9f5bca2054c6f6fca2606b691/leiningen-core/src/leiningen/core/main.clj#L388-L397

c.f. https://github.com/technomancy/leiningen/pull/637, https://github.com/technomancy/leiningen/issues/636

Examples

A few examples of user agents that different systems provide:

Possible solutions

Setting the system property to something like Boot/2.7.2 (Java 1.8.0_171; Linux 4.4.0-127-generic) seems like it could work.

You could also provide a configuration object with this information in it, but this wouldn't be as easy and I don't think it is necessary to be this flexible.

alandipert commented 6 years ago

Seems like a good idea, I'd be open to a PR. Thanks for bringing this up.