question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maven resolution fails behind proxy

See original GitHub issue

The %maven line magic code throws an error. I guess it is due to my proxy settings. It seems as if the resolver does not take into account the proxy settings? Is there a way to give the resolver a proxy configuration?

Command: %maven org.knowm.xchart:xchart:3.5.2 or %maven org.apache.commons:commons-math3:3.6.1

Result:

java.lang.RuntimeException: Exception occurred while running line magic ‘maven’: Unable to collect/resolve dependency tree for a resolution due to: Failed to collect dependencies at org.knowm.xchart:xchart:jar:3.5.2, caused by: Connection refused: connect at .lineMagic(#9:10) at .(#76:1)

I tried: System.setProperty("http.proxyHost", proxyHost); System.setProperty("https.proxyHost", proxyHost); System.setProperty("http.proxyPort", proxyPort); System.setProperty("https.proxyPort", proxyPort);

With this I can successfully make network communications, i.e. the proxy configuration works. E.g.: URL url = new URL("http://www.example.org/"); InputStream in = url.openStream(); The above code works. However the maven resolution still fails.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelmiorcommented, Dec 20, 2018

No problem, I understand. I was just using artifacts from Maven Central, so it seems unlikely to be any configuration issues. Anyway, things are working great now! I’ve been looking for something like IJava for a while and other than this initial hiccup, I’ve been pleasantly surprised with how well it works 😃

0reactions
SpencerParkcommented, Dec 20, 2018

@michaelmior I’m working on a switch to use ivy (ivy-branch) which should allow using the system properties for setting up a proxy as well as having access to fix issues like these when they pop up. I should have some more time during the holidays to get some solid time in on pushing a few things out that I’ve been working on including this.

Failing transfer could be an https error with certificates? Could be issues with authentication of a private repo? Take a look at system variables on the working jvm and broken one and look for differences. It could also just be issues on the other side (remote is down?) or network issues? Also maven may be configured via global configurations that the magic doesn’t consider? I’m sorry that’s not much help, but I’m not really sure whats wrong 😕

As far as it suddenly working: if you managed to download the dependencies to your maven local repo, the magic would find them there and should not require connecting to the remote repo which might be what happened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use Maven through a proxy? - Stack Overflow
You need to add proxy configuration to your settings.xml. Here's a trick in your username field. Make sure it looks like domain\username. Setting...
Read more >
How to enable proxy setting in Maven - Mkyong.com
If you are behind a proxy, Maven will fail to download the project dependencies. P.S Tested with Maven 3.6. 1. Proxy Access. 1....
Read more >
How to Set Proxy for Maven? - Java Helps
You must set proxy for maven if you are behind a corporate proxy. This article explains how to set proxy for maven with...
Read more >
Using Maven Behind a Proxy - Baeldung
In this tutorial, we're going configure Maven to work behind a proxy – a common situation in environments where we don't connect directly...
Read more >
1584996 – [Behindproxy]Failed to connect to maven repo ...
Description of problem: Meet below error when build with openshift/wildfly-101-centos7 image in a behind proxy cluster: [INFO] Downloading: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found