shadow-cljs icon indicating copy to clipboard operation
shadow-cljs copied to clipboard

Configure download agent

Open wangmiao1002 opened this issue 2 years ago • 6 comments

My machine has restricted the external network access environment. When using shadow cljs, the jar cannot be downloaded. How can I set up proxy downloading? Thank you

shadow-cljs - config: /home/devuser/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependency update failed - Could not transfer artifact thheller:shadow-cljs:jar:aot:2.19.1 from/to central (https://repo1.maven.org/maven2/): Connect to repo1.maven.org:443 [repo1.maven.org/151.101.40.209] failed: Connection refused (Connection refused)
DependencyResolutionException Could not transfer artifact thheller:shadow-cljs:jar:aot:2.19.1 from/to central (https://repo1.maven.org/maven2/): Connect to repo1.maven.org:443 [repo1.maven.org/151.101.40.209] failed: Connection refused (Connection refused)
        org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:355)
        jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
        jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
        jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke (Method.java:566)
        clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
        clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
        cemerick.pomegranate.aether/resolve-dependencies* (aether.clj:806)
        cemerick.pomegranate.aether/resolve-dependencies* (aether.clj:707)
        clojure.core/apply (core.clj:665)
        clojure.core/apply (core.clj:660)
        cemerick.pomegranate.aether/resolve-dependencies (aether.clj:815)
Caused by:
ArtifactResolutionException Could not transfer artifact thheller:shadow-cljs:jar:aot:2.19.1 from/to central (https://repo1.maven.org/maven2/): Connect to repo1.maven.org:443 [repo1.maven.org/151.101.40.209] failed: Connection refused (Connection refused)

wangmiao1002 avatar Jun 08 '22 06:06 wangmiao1002

You can use :maven {:mirrors ...} in shadow-cljs.edn or ~/.shadow-cljs/config.edn. The :maven map takes the same options as leiningen would in its place. So :proxy is supported as well. Don't really know what that looks like though since I have never used it.

If you have a working setup for deps.edn or lein you can just use those tools instead to download the dependencies.

thheller avatar Jun 08 '22 07:06 thheller

OK, let me try. Thank you for your answer

wangmiao1002 avatar Jun 08 '22 07:06 wangmiao1002

I have the same problem and couldn't get the :maven-configuration to work.
Since I also could never get this working with Leiningen, I wrote a small bb-task that would download all (transitive) dependencies and bundle them in a zip (which I can get behind the firewall).

I just published it: https://github.com/MrGung/deps-bundler

MrGung avatar Jun 20 '22 18:06 MrGung

I just realised that my solution currently does not bundle POMs. Also, shadow-cljs-2.19.3-aot.jar ist not included.
I'll fix that when time permits.

MrGung avatar Jun 21 '22 07:06 MrGung

What is the particular issue blocking you from accessing maven directly? And what is the particular problem with maven configuration? Do you have access to a mirror or a proxy?

Instead of zipping the dependencies you could just rsync (or similar) the ~/.m2/repository folder after downloads are finished. That'll include all the necessary files. Just downloading the classpath .jars is not enough to actually build a classpath.

The AOT variant you can download via thheller/shadow-cljs$aot in deps.edn instead of just thheller/shadow-cljs.

thheller avatar Jun 21 '22 07:06 thheller

My company totally blocks access to the internet. rsync is therefore not possible. Maven is accessed via a proxy. There is no proxy for clojars.

I haven't investigated the issue with the configuration further - because even if I could access maven then, I'd still miss dependencies from clojars.

This morning I downloaded 3 or 4 missing POMs and the AOT-variant manually. shadow-cljs works for now.

MrGung avatar Jun 21 '22 08:06 MrGung