How do I setup maven API deployments to work with a http/https proxy server ?

1 4 2,105

Maven based deployment needs access the maven repository to resolve maven dependencies. If your network is setup such maven repositories can only be accessed via a http/https proxy server you need to add the http.proxyHost and http.proxyPort to your maven deployment command.

The apigee maven deployment command would look like below.

mvn apigee-enterprise:deploy -P<env> -Dusername=<usr> -Dpassword=<pwd> -Dhttp.proxyHost=<http_proxy_ip> -Dhttp.proxyPort=<http_proxy_port> -Dhttps.proxyHost=<https_proxy_ip> -Dhttps.proxyPort=<https_proxy_port>

Comments
Girish_gajria1
Participant III

Was looking for this information. But now, I get the below error:

[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.0:deploy (install-bundle-step) on project myOAuth-1: MojoExecutionException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required" -> [Help 1]

So is it also possible to send in the credentials as https.proxyUser and https.proxyPassword? Because most proxies authenticate the users anyway. Or is it even possible to inherit the proxy related information from Maven's configuration? That would be the best.

Thanks,

Girish

Not applicable

You can pass authentication on the URL with http://username:password@example.com/.

Girish_gajria1
Participant III

Hello @David Allen,

Tried the same, still getting the same error.

Below is the setup of the environment vars:

MAVEN_OPTS=-Dhttps.proxyHost=*** -Dhttps.proxyPort=*** -Dhttps.proxyUser=*** -Dhttps.proxyPassword=*** -Dusername=*** -Dpassword=***

Below is the full staccktrace of error:

[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.0:deploy (default-cli) on project messaging-sms: MojoExecutionException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required" -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.0:deploy (default-cli) on project messaging-sms:
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
  at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
  at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException:
  at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.processHelpfulErrorMessage(DeployMojo.java:343)
  at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute(DeployMojo.java:328)
  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
  ... 20 more
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required"
  at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:1872)
  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
  at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1090)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
  at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:79)
  at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:895)
  at io.apigee.buildTools.enterprise4g.rest.RestUtil.uploadBundle(RestUtil.java:342)
  at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.doImport(DeployMojo.java:152)
  at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute(DeployMojo.java:276)
  ... 22 more
[ERROR]

Thanks,

Girish

yuriyl
Staff

Do you really need proxy credentials?

I.e., your proxy setting in IE do not use credentials, do they?

Are you on a Windows box in a Windows domain?

It might be an NTML proxy collection issue.

If yes, download and setup http://cntlm.sourceforge.net/ and point maven to the cntlm server.

Version history
Last update:
‎04-21-2015 08:37 PM
Updated by: