boot-clj / boot-clj/boot

Set user agent on Maven download requests

Open
#700 1 comment 0 reactions 0 assignees View on GitHub
Enhancement needs documentation
Dominant language
Clojure
Stars
1.7k
Forks
178
PR merge metrics
No merged PRs in 30d

Description

### 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`](http://sonatype.github.io/sonatype-aether/apidocs/constant-values.html#org.sonatype.aether.ConfigurationProperties.USER_AGENT):

### 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:

* Apache-HttpClient/4.5.3 (Java/1.8.0_162)
* Leiningen/2.8.1 (Java OpenJDK 64-Bit Server VM; Linux 4.10.0-38-generic; amd64)
* Apache-Maven/3.5.3 (Java 1.8.0_171; Linux 4.4.0-127-generic)

### 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](https://maven.apache.org/resolver/apidocs/org/eclipse/aether/ConfigurationProperties.html#USER_AGENT) with this information in it, but this wouldn't be as easy and I don't think it is necessary to be this flexible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.