Open khorfox opened 4 years ago
If you set JAVA_OPTIONS it should work as that's picked up by Java itself - jbang isn't deliberately blocking that. Afaik it should just use proxy settings.
Not sure how to mimick your setup so I can test.
Hmmm. I does look like shrink wrap resolver isn't being nice citizen but instead listening to proxy settings in a settings.xml.
We probably need to add a setting to override this.
okey - now at laptop so could check what is happening.
jbang uses shrinkwrap resolvers and that library does not honor java proxy settings via properties but it do read ~/.m2/settings.xml for settings like additional repos and proxies.
can you try make a ~/.m2/settings.xml with something as described in http://maven.apache.org/guides/mini/guide-proxies.html with the settings for your proxy ?
That would be great to know if works as I don't have a good way of testing it.
@maxandersen I created ~/.m2/settings.xml as suggested in the maven doc and then ran ./gradlew build
several tests fail with the "org.jboss.shrinkwrap.resolver.api.NoResolvedResultException"
. This was on Debian 10.
Where are you running Gradlew build? And can you show the full stack trace ?
This issue is about running jbang - not gradle related.
@maxandersen - I am running the gradle build on a Debian 10 that is behind a proxy. If I run the same on my personal machine (again Debian 10, but no proxy involved), the dependencies related tests run successfully.
Sorry about not being clear in the previous comment - What I tried to convey is that the jbang build passes when run on a box that isn't behind a proxy and fails on boxes that are behind a proxy.
Okey but there is no "gradle build" with jbang. Jbang builds itself.
Can you show the actual output of running 'jbang --verbose your app.java' ?
And if you are trying to run the build.gradle created by jbang edit then sure i could see that have problems we might need some fix for but that's a separate concern from running jbang.
So please attach the full output so I can see the context/stack traces.
Thank you!
Sure, I am off the corporate network now. I'll get that to you ASAP.
So, to explain what I did, after jbang --verbose first.java
failed and you pointed to this bug and that too did not work, I did a git clone
of the jbang repository, tried ./gradlew build
of jbang itself to see if I can figure out what's going on. And when doing that, noticed that the tests related to dependencies failed. So, I tried the same(cloning the repo and building) on my home Internet connection where I don't have a proxy and that passed fine. Thanks
Ack - now I understand what you did.
This is not a surprise though since the tests are run in isolation of any proxy/maven/gradle setup so I don't expect these to "just work".
I'll need to try find way too add a proxy locally to reproduce.
Is there an update to this?
I am experiencing the same problem. I cannot get through the corporate proxy.
The settings.xml
did not help. JAVA_TOOL_OPTIONS
does not help.
At home jbang
works fine.
@bjt-user JDK_JAVA_OPTIONS
is the preferred variable to be set these days. I encountered the same problem (on linux, but it should not matter) and setting that in the environment solved it.
curl -Ls https://sh.jbang.dev | JDK_JAVA_OPTIONS="-Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=1088" bash -s - app install ...
interesting @liviu-vasut ; as I understand it JDK_JAVA_OPTIONS and JAVA_TOOL_OPTIONS should work equally well here; just that JDK_JAVA_OPTIONS only works for java
and requires Java 9+.
What versions of java are you using @bjt-user and @liviu-vasut ?
I'm using java 11, and yes, you are right @maxandersen, JAVA_TOOL_OPTIONS
works too. Last week I struggled a bit until I got the working combination and I must have messed something up... But I tested both variants this morning and they both work.
@maxandersen I am using openjdk version "17.0.2" 2022-01-18 LTS
.
But I just tested it with openjdk version "11.0.14.1" 2022-02-08 LTS
and its still not going through.
It says NOTE: Picked up JDK_JAVA_OPTIONS:...
but still doesn't reach the internet.
@liviu-vasut This issue is labeled windows
.
@liviu-vasut This issue is labeled
windows
.
I saw that, @bjt-user, but in this case is not important. JDK options are platform independent, proved by the fact that after setting the proxy with the JDK_JAVA_OPTIONS
you got the line ...Picked up JDK_JAVA_OPTIONS...
. Why it still doesn't work, that's another matter. Do you need a user/password maybe? Does any other program pass through that proxy? Does it print anything else after failing?
I tried a simple helloword with dependencies (work correctly at home) on my corporate environment. I tried to set the proxy via environment variables (http.proxy): not work. I tried to modify the jbag.cmd and passing JAVA_OPTIONS with proxy, user, password: not work. There's a way to set corporate proxy and authentication ? The stack trace is: [jbang] Resolving dependencies... [jbang] Resolving com.github.lalyos:jfiglet:0.0.8...Done [jbang] Resolving info.picocli:picocli:4.5.0...[jbang] [ERROR] Could not resolve dependency dev.jbang.ExitException: Could not resolve dependency at dev.jbang.DependencyUtil.lambda$resolveDependenciesViaAether$3(DependencyUtil.java:145) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at dev.jbang.DependencyUtil.resolveDependenciesViaAether(DependencyUtil.java:152)