Building the software behind HTTP proxy

77 views
Skip to first unread message

Steffen Dettmer

unread,
Jun 12, 2018, 6:06:41 AM6/12/18
to jsonschema2pojo-users
Hi,

I prepared a (hopefully) small change to contribute and want to test it. So of couse I need to build it first, but  I think I should use "mvn package" to build it for my local testing.

Unfortunately the build fails in test goal (via package goal) of org.jsonschema2pojo.gradle.JsonSchemaPluginSpec (from jsonschema2pojo-gradle-plugin) with error:

  org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-2.3-bin.zip
  [...]
     Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-2.3-bin.zip".

I get the same HTTP error when I try to retrieve the file without proxy (in my company proxy usage is required). I set "http_proxy" environment variable and use a maven global settings file with <proxy> (since Maven seems to ignore the environment variable).

Do I need to set something else to specify my proxy?

Can the file be provided elsewhere? I'd prefer the possibility to build w/o internet.

I tried using a file, but I couldn't get it working. I downloaded the ZIP file and configured a file:/// URL. I noticed that for the test the example properties is used, so I changed it:

--- a/jsonschema2pojo-gradle-plugin/example/java/gradle/wrapper/gradle-wrapper.properties
+++ b/jsonschema2pojo-gradle-plugin/example/java/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
+distributionUrl=file\:///local/users/sdettmer/work/jsonschema2pojo/gradle-2.3-bin.zip

then I get a java.util.zip.ZipException: error in opening zip file, unfortunately without further details:

  Caused by: java.util.zip.ZipException: error in opening zip file
          at java.util.zip.ZipFile.open(Native Method)

The file is OK according to "unzip -t":

  $ unzip -t /local/users/sdettmer/work/jsonschema2pojo/gradle-2.3-bin.zip
  Archive:  /local/users/sdettmer/work/jsonschema2pojo/gradle-2.3-bin.zip
      testing: gradle-2.3/              OK
  [...]
      testing: gradle-2.3/lib/plugins/hamcrest-core-1.3.jar   OK
  No errors detected in compressed data of /local/users/sdettmer/work/jsonschema2pojo/gradle-2.3-bin.zip.

I also checked that it tries the correct file: if I append "xxx" to the value of distributionUrl, I get

  java.io.FileNotFoundException: /local/users/sdettmer/work/jsonschema2pojo/gradle-2.3-bin.zip.xxx (No such file or directory)

as expected, so I think by distributionUrl is correct.

What do I do wrongly?

Steffen


Joe Littlejohn

unread,
Jun 12, 2018, 10:35:12 AM6/12/18
to jsonschema...@googlegroups.com
This URL works fine for me. Sounds like your proxy is blocking this request.

Could you host this file inside your corporate network somewhere and update the URL?

--
You received this message because you are subscribed to the Google Groups "jsonschema2pojo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsonschema2pojo-...@googlegroups.com.
Visit this group at https://groups.google.com/group/jsonschema2pojo-users.
For more options, visit https://groups.google.com/d/optout.

Steffen Dettmer

unread,
Jun 12, 2018, 11:57:08 AM6/12/18
to jsonschema...@googlegroups.com
Hi,

Yes, using Web Browser or wget I also can download (using corporate
proxy). So surely the URL works in general.

What I meant was:

1) It is not using the proxy at all. It tries direct internet access
which is blocked by some firewall.
How to configure proxy usage?

2) I tried to host on my file system with file: URL, but this seems
not to be supported, but looks a bit like a bug, because it accesses
the file, but apparently incorrectly.
Is there another way / extra setting needed to use regular files?

Steffen

Joe Littlejohn

unread,
Jun 13, 2018, 11:49:14 AM6/13/18
to jsonschema...@googlegroups.com
Are you aware of the Java options http.proxyHost and http.proxyPort? You might be able to solve this by adding these to your MAVEN_OPTS env var.

Steffen Dettmer

unread,
Jun 14, 2018, 5:28:42 AM6/14/18
to jsonschema...@googlegroups.com
Hi,

thanks again for your help. No, I wasn't aware of that, I though Maven
would use the values from settings.xml.
I added MAVEN_OPTS="-Dhttp.proxyHost=web-proxy -Dhttp.proxyPort=8080"
but it seems to have no effect.
According to https://stackoverflow.com/questions/5016508/maven-test-behind-proxy-squid
I also have to set "-DforkMode=never", but this makes the Scala tests
fail[1].

But since you already realized the change anyway this is no problem :)
Thank you.

Steffen






[1]
INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @
jsonschema2pojo-scalagen ---
[WARNING] The parameter forkMode is deprecated since version 2.14. Use
forkCount and reuseForks instead.
[WARNING] useSystemClassloader setting has no effect when not forking
Running com.mysema.scalagen.SerializationTest
Tests run: 40, Failures: 0, Errors: 37, Skipped: 1, Time elapsed:
0.132 sec <<< FAILURE! - in com.mysema.scalagen.SerializationTest
IfElse(com.mysema.scalagen.SerializationTest) Time elapsed: 0.082 sec
<<< ERROR!
java.io.FileNotFoundException:
src/test/scala/com/mysema/examples/IfElse.java (No such file or
directory)
at com.mysema.scalagen.SerializationTest.IfElse(SerializationTest.scala:150)
.
.
.
Reply all
Reply to author
Forward
0 new messages