Compiling the Spring Framework from behind a proxy

This is one of those things that turns out to be incredibly easy, if only I had realized that ages ago.

First: do not use Maven! It will not work. Instead, use Ant. (This is an important note, because I'm trying to create the Maven artifacts to include in a local repository. More on that later.)

Next up, because the build process uses JetS3t, a library for accessing Amazon S3, the usual configuration method of setting the "http.proxyHost" Java property will not work. (Grr.)

So instead, go to the projects/spring-build/lib/ivy directory (of course!) and edit the jets3t.properties file.

Change httpclient.proxy-autodetect to false, since the proxy autodetect appears to be broken. Then set httpclient.proxy-host and httpclient.proxy-port as appropriate.

And that's it for the proxy server. It should now be using your proxy server, rather than completely ignoring it.

Next up, check your ANT_OPTS variable, and make sure that you have -Xmx512M (or similar) in there - otherwise, the build will run out of memory and crash. (Sigh.)

Also, if you have Apache Ivy installed, remove it. You need to allow Spring to use its own copy, which includes the above JetS3t library and a plugin to Ivy that allows Ivy to use Amazon S3.

After this, it should successfully build with a simple "ant". For me, it ran through the build step OK, successfully creating the JAR files. Then it bombed out within the testing steps - but, hey, at least it built.

So now onto the Maven artifacts. Once you've built it using Ant, Ivy will have downloaded all the JAR files that will otherwise be missing.

The command I used was mvn deploy -P staging. This enables the "staging" profile that the POM uses to build the artifacts. (OK, actually, I used mvn deploy -P staging -Dmaven.test.skip=true due to the tests failing as mentioned above.)

And I still haven't completed the build, but it appears to be due to the freaking proxy server (in this case, both the local Maven repository proxy server, and the actual proxy server) having issues. But it looks like it's working. Ish.

Topics: