plugin sdk does not use http proxy?
Asked by Nicolas Nicolas:

Hi,

I am trying to build a plugin using the SDK. The "atlas-create-bamboo-plugin script attempts to download some files and fails because I am behind a proxy. How do I tell the SDK that it should use the proxy?

Thanks

nick


Answers:
author: Ramiro Pointis
body: After searching a lot I found a workaround:

You have to add

-Dhttps.proxyHost=my_proxy_host and -Dhttps.proxyPort=my_proxy_port

to

**\\\<path to sdk\>\\apache-maven\\bin\\mvn.bat** as described in

<http://jira.codehaus.org/browse/MRM-1413>

The problem is that the maven only reads the first proxy option in the settings.xml

comments: author: Simone Longoni
body: Ramiro,

you are the One!

After tons of search and attempts, your suggestion was the only one to unblock me!

Thanks a lot,

Simone


author: Ramiro Pointis
body: Glad it helped Simone!


author: HB Xie
body: More percisely, set MAVEN_CMD_LINE_ARGS to -Dhttps.proxyHost=my_proxy_host and -Dhttps.proxyPort=my_proxy_port in my case


author: Cobin Dopkeen
body: Ramiro, HB Xie, I don't understand exactly where to place this in code... Could you please be more specific?Thank you very much! This problem is driving me mad.


author: HB Xie
body: some thing like

:Win9xArg  
@REMSlurp the command line arguments. This loop allows for an unlimited number  
@REMof agruments (up to the command line limit, anyway).  
set MAVEN_CMD_LINE_ARGS= -**Dhttps.proxyHost** =xxx.xxx.xxx.xxx -Dhttps.proxyPort=80  
:Win9xApp  
if %1a==a goto endInit  
set MAVEN_CMD_LINE_ARGS=%MAVEN_CMD_LINE_ARGS% %1 -**Dhttps.proxyHost** =xxx.xxx.xxx.xxx -Dhttps.proxyPort=80  
shift  
goto Win9xApp

do the same with :WinNTNovell and :4NTArgs if does not work


author: Cobin Dopkeen
body: Thank you for your help, HB Xie. Unfortunately this turns out to not be my problem, but thank you for your prompt and detailed response.


author: kevin_shine
body: To get HTTPS support:

Edit the atlas-run-standalone.bat and change

%MAVEN_EXECUTABLE% com.atlassian.maven.plugins:maven-amps-plugin:3.11:run-standalone %MVN_PARAMS%

to

%MAVEN_EXECUTABLE% com.atlassian.maven.plugins:maven-amps-plugin:3.11:run-standalone %MVN_PARAMS% -Dhttps.proxyHost=your.proxy.co.za -Dhttps.proxyPort=8080

comments: author: HB Xie
body: this solution only for atlas-run-standalone.bat, still suggest to modify the **\\\<path to sdk\>\\apache-maven\\bin\\mvn.bat.**


author: sap
body: Kevin this was one great answer.Solved the issue for me as well


author: David at David Simpson Apps
body: If that's *all you have* in your **settings.xml**, you'll likely have a problem.

Here's an *actual example* of the proxy settings I used at a previous job (it needed http and https proxies setting):

```
&lt;proxy&gt;			&lt;active&gt;true&lt;/active&gt;			&lt;protocol&gt;http&lt;/protocol&gt;			&lt;host&gt;mainproxy.nottingham.ac.uk&lt;/host&gt;			&lt;port&gt;8080&lt;/port&gt;			&lt;nonProxyHosts&gt;www.nottingham.ac.uk|*.nottingham.ac.uk&lt;/nonProxyHosts&gt;		&lt;/proxy&gt;		&lt;proxy&gt;			&lt;active&gt;true&lt;/active&gt;			&lt;protocol&gt;https&lt;/protocol&gt;			&lt;host&gt;mainproxy.nottingham.ac.uk&lt;/host&gt;			&lt;port&gt;8080&lt;/port&gt;			&lt;nonProxyHosts&gt;www.nottingham.ac.uk|*.nottingham.ac.uk&lt;/nonProxyHosts&gt;		&lt;/proxy&gt;
```

This goes under the \<proxies\> node under the root \<settings\> node. Take a look at **atlassian-plugin-sdk-3.7/apache-maven/conf/settings.xml** and perhaps copy that with minor edits to **\~/.m2/settings.xml**  

comments: author: Nicolas Nicolas
body: It unfortunately still doesn't work. I copied

```
atlassian-plugin-sdk-3.7/apache-maven/conf/settings.xml
```

and added two proxy sections just like you suggested. It still doesn't work. On the other hand, wget has no problems going through the proxy. Unfortunately I can't paste my current settings.xml file into this reply since I am somewhat character limited. Maybe I am not getting stuck at the proxy? Below is the error message I am getting:

```
$ ../atlassian-plugin-sdk-3.6.2/bin/atlas-create-bamboo-pluginExecuting: /home/nbock/atlassian-plugin-sdk-3.6.2/apache-maven/bin/mvn com.atlassian.maven.plugins:maven-bamboo-plugin:3.6.2:create [INFO] Scanning for projects...Downloading: https://m2proxy.atlassian.com/repository/public/com/atlassian/maven/plugins/maven-bamboo-plugin/3.6.2/maven-bamboo-plugin-3.6.2.jar[WARNING] Unable to get resource 'com.atlassian.maven.plugins:maven-bamboo-plugin:maven-plugin:3.6.2' from repository atlassian-public (https://m2proxy.atlassian.com/repository/public): Error transferring file: Connection refused
```


author: David at David Simpson Apps
body: I'd suggest you try working from home. That way, you can likely get around any proxy issues :)


author: Nicolas Nicolas
body: I totally agree, our proxy here makes life just a little too exciting for my taste.


author: sap
body: I get the following error while running

atlas-run-standalone --product jira

have tried things suggested by Ramiro and David.Wtill no way out of thr following error

<br />

<br />

\[INFO\] \[2.ContainerStartMojo\] Resolved container artifact org.codehaus.cargo:car  
go-core-container-tomcat:jar:1.2.3 for container tomcat7x  
\[INFO\] \[stalledLocalDeployer\] Deploying \[D:\\Plugin4.2.4\\amps-standalone\\target\\j  
ira\\jira.war\] to \[D:\\Plugin4.2.4\\amps-standalone\\target\\container\\tomcat7x\\cargo  
-jira-home/webapps\]...  
\[INFO\] \[talledLocalContainer\] Tomcat 7.x starting...  
\[INFO\] \[yer.DeployerWatchdog\] Deployable \[http://localhost:2990/cargocpc/index.h  
tml\] failed to finish deploying within the timeout period \[600000\]. The Deployab  
le state is thus unknown.  
\[INFO\] ------------------------------------------------------------------------  
\[ERROR\] BUILD ERROR  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Unable to execute mojo  

Deployable \[http://localhost:2990/cargocpc/index.html\] failed to finish deployin  
g within the timeout period \[600000\]. The Deployable state is thus unknown.


author: David at David Simpson Apps
body: You need to define a proxy in your settings.xml file located in the maven home directory e.g. in \~/.m2 or in the sdk below the apache-maven directory.

comments: author: Nicolas Nicolas
body: I have put this in the configuration file:

```
$ cat ~/.m2/settings.xml&lt;settings&gt;  &lt;proxies&gt;    &lt;proxy&gt;      &lt;active&gt;true&lt;/active&gt;      &lt;protocol&gt;http&lt;/protocol&gt;      &lt;host&gt;proxyout&lt;/host&gt;      &lt;port&gt;8080&lt;/port&gt;      &lt;nonProxyHosts&gt;127.0.0.1&lt;/nonProxyHosts&gt;    &lt;/proxy&gt;  &lt;/proxies&gt;&lt;/settings&gt;
```

I am still getting an error though. Is the configuration file correct? Or do I need to specify that the proxy is to be used also in case the connection is https as opposed to http, since the SDK script accesses everything over https?


author: sap
body: I get this error after folllowing all the above mentioned changes

\[INFO\] \[2.ContainerStartMojo\] Resolved container artifact org.codehaus.cargo:car  
go-core-container-tomcat:jar:1.2.3 for container tomcat7x  
\[INFO\] \[stalledLocalDeployer\] Deploying \[D:\\Plugin4.2.4\\amps-standalone\\target\\j  
ira\\jira.war\] to \[D:\\Plugin4.2.4\\amps-standalone\\target\\container\\tomcat7x\\cargo  
-jira-home/webapps\]...  
\[INFO\] \[talledLocalContainer\] Tomcat 7.x starting...  
\[INFO\] \[yer.DeployerWatchdog\] Deployable \[http://localhost:2990/cargocpc/index.h  
tml\] failed to finish deploying within the timeout period \[600000\]. The Deployab  
le state is thus unknown.  
\[INFO\] ------------------------------------------------------------------------  
\[ERROR\] BUILD ERROR  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Unable to execute mojo  

Deployable \[http://localhost:2990/cargocpc/index.html\] failed to finish deployin  
g within the timeout period \[600000\]. The Deployable state is thus unknown.


author: Roman Samorodov
body: Hi all!

I had the same problem but finally I resolved it.

Steps to go:

1. Install cntlm from [HERE](http://stackoverflow.com/questions/23539048/maven-behind-a-auto-generated-proxy). And follow the instructions carefully
2. Open %SDK DIRECTORY%\\apache-maven-3.2.1\\conf\\settings.xml  
   Use this code in \<proxy\> area:  

   \<proxy\>  
   \<active\>true\</active\>  
   \<protocol\>http\</protocol\>  
   \<host\>127.0.0.1\</host\>  
   \<port\>3128\</port\>  
   \</proxy\>  
   \<proxy\>  
   \<active\>true\</active\>  
   \<protocol\>https\</protocol\>  
   \<host\>127.0.0.1\</host\>  
   \<port\>3128\</port\>  
   \</proxy\>


author: M Hoogenboom
body: Finally got it working by running (no marketplace not reachable errors anymore):  
atlas-run --jvmargs "-Dhttp.proxyHost=myproxy -Dhttp.proxyPort=8080 -Dhttps.proxyHost=myproxy -Dhttps.proxyPort=8080 -DallowGoogleTracking=false"..

Furthermore, I think you only need the http proxy settings (not https) in the settings.xml for being able to download artifacts through the proxy. You will need the https proxy settings if you use mvn 3.2.3.

Note that I also had to add "MVN_PARAMS="-gs ${M2_HOME}/conf/settings.xml -DallowGoogleTracking=false -Dhttp.proxyHost=testproxy -Dhttp.proxyPort=8080 -Dhttps.proxyHost=testproxy -Dhttps.proxyPort=8080" in the atlas-run script, else I get an error on the MojoExecutor:

\[ERROR\] Failed to execute goal com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:5.0.13:run (default-cli) on project jira-project-template-plugin: Unable to execute mojo: Execution null of goal com.atlassian.maven.plugins:maven-jira-plugin:5.0.13:run failed: [java.net](http://java.net).ConnectException: Connection refused -\> \[Help 1\]  
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:5.0.13:run (default-cli) on project jira-project-template-plugin: Unable to execute mojo...

Pretty annoying if you have to switch between proxy at work and direct internet at home...


author: M Hoogenboom
body: This is becoming pretty annoying... I think I've tried all suggestions above, but is seems to be hard coded somehow in one of the delivered jars. No matter where I add MAVEN_CMD_LINE_ARGS (/usr/share/atlassian-plugin-sdk-5.0.13/apache-maven-3.2.1/bin/mvnmvn, I'm running on linux, not on windows), http \& https proxy configuration in atlassian /usr/share/atlassian-plugin-sdk-5.0.13/apache-maven-3.2.1/conf/settings.xml/conf/settings, MVN_PARAMS in atlas-run and atlas-run-standalone, the proxy is never added to the JVM Input Arguments of my JIRA atlassian sdk instance.

mvn knows how to find the proxy as it is downloading the required artifacts via the proxy, but the JIRA runtime cannot connect to atlassian market place.

Hope someone figured this out with the latest version of the Atlassian Plugin SDK 5.0.13 / JIRA v6.4.4#64019.


author: Abhishek Gupta
body: I am facing exactly the same problem as Sunil. Please help.


author: sunil1kr
body: Hi,

I tried all the suggested option but still I am facing same issue.

Below is the error that I am getting.

\[INFO\] ------------------------------------------------------------------------  
\[INFO\] BUILD FAILURE  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Total time: 3.589 s  
\[INFO\] Finished at: 2015-04-24T19:23:56+05:30  
\[INFO\] Final Memory: 13M/150M  
\[INFO\] ------------------------------------------------------------------------  
\[ERROR\] Failed to execute goal com.atlassian.maven.plugins:maven-amps-plugin:5.0.13:run-standalone (default-cli) on project standalone-pom: Execution default-cli of goal  
com.atlassian.maven.plugins:maven-amps-plugin:5.0.13:run-standalone failed: Plugin com.atlassian.maven.plugins:maven-amps-plugin:5.0.13 or one of its dependencies could n  
ot be resolved: Failed to collect dependencies at com.atlassian.maven.plugins:maven-amps-plugin:jar:5.0.13 -\> com.atlassian.plugins.rest:atlassian-rest-doclet:jar:2.9.2 -  
\> com.atlassian.jersey:atlassian-jersey-restdoc:jar:1.0.3 -\> com.atlassian.plugins.rest:atlassian-rest-common:jar:2.9.2-m01: Failed to read artifact descriptor for [com.at](http://com.at)  
lassian.plugins.rest:atlassian-rest-common:jar:2.9.2-m01: Could not transfer artifact com.atlassian.plugins.rest:atlassian-rest-common:pom:2.9.2-m01 from/to atlassian-pub  
lic (<https://maven.atlassian.com/repository/public>): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild  
erException: unable to find valid certification path to requested target -\> \[Help 1\]  
\[ERROR\]  
\[ERROR\] To see the full stack trace of the errors, re-run Maven with the -e switch.  
\[ERROR\] Re-run Maven using the -X switch to enable full debug logging.  
\[ERROR\]  
\[ERROR\] For more information about the errors and possible solutions, please read the following articles:  
\[ERROR\] \[Help 1\] <http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException>

Please help to get it resolved.

comments: author: Abhishek Gupta
body: I am facing exactly the same problem as Sunil. Please help.


author: klang
body: I just deleted \~/.m2/repository/com/atlassian, then executed 'atlas-run' again and everyting worked.

mvn really IS able to set your hair on fire..


author: childnode
body: I just deleted my \~/.m2/repository, then rerun the build AFTER adding the proxy!! That's how it got fixed for me.. obscure mvn caching ;/


author: Janaksinh Mahida
body: Hi David Simpson (and for that matter all of you)

Thank you in my case i had to update settings.xml accordinglyas i was trying to save time by copy pasting entire set up from my collegues machine. We both are behind the firewall but surprisingly i was not able to build however he would able to do that.

I have updated settings.xml as described and I was able to get ahead thank you once again. :)


author: Simone Longoni
body: Ramiro,

you are the One!

After tons of search and attempts, your suggestion was the one to unblock me!

Thanks a lot,

Simone