Keep in mind you'll have to specify the proxy for http and https separately.
-Dhttp.proxy.server=localhost -Dhttp.proxy.port=8888 -Dhttps.proxy.server=localhost -Dhttps.proxy.port=8888
In addition to those options you could also use additional options such as:
-Dhttp.proxyUser=userid
-Dhttp.proxyPassword=password
-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost
(Don't forget to specify this for http and https)