Add support for custom protocols (#327)

* Add configuration to fetch custom protcol handlers

* Tweak things

Co-authored-by: Alexandre Archambault <[email protected]>
This commit is contained in:
Guillaume Massé
2021-11-23 21:14:52 +01:00
committed by GitHub
co-authored by Alexandre Archambault
parent 2eaf7aef43
commit 92e40c2225
15 changed files with 303 additions and 33 deletions
@@ -0,0 +1,18 @@
package coursier.cache.protocol;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
import java.io.IOException;
public class CustomprotocoljavaHandler implements URLStreamHandlerFactory {
public URLStreamHandler createURLStreamHandler(String protocol) {
return new URLStreamHandler() {
protected URLConnection openConnection(URL url) throws IOException {
return new URL("https://repo1.maven.org/maven2" + url.getPath()).openConnection();
}
};
}
}