plugin sdk does not use http proxy?

Nicolas Nicolas November 8, 2011

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

13 answers

1 accepted

13 votes
Answer accepted
Ramiro Pointis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2012

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

Simone Longoni May 3, 2012

Ramiro,

you are the One!

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

Thanks a lot,

Simone

Ramiro Pointis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 3, 2012

Glad it helped Simone!

HB Xie July 8, 2013

More percisely, set MAVEN_CMD_LINE_ARGS to -Dhttps.proxyHost=my_proxy_host and -Dhttps.proxyPort=my_proxy_port in my case

Cobin Dopkeen August 13, 2014
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.
HB Xie August 14, 2014

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

Cobin Dopkeen August 14, 2014
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.
3 votes
kevin_shine August 16, 2012

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

HB Xie July 8, 2013

this solution only for atlas-run-standalone.bat, still suggest to modify the \<path to sdk>\apache-maven\bin\mvn.bat.

sap
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2013

Kevin this was one great answer.Solved the issue for me as well

1 vote
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 9, 2011

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


Nicolas Nicolas November 14, 2011

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-plugin
Executing: /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

David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 15, 2011

I'd suggest you try working from home. That way, you can likely get around any proxy issues :)

Nicolas Nicolas November 15, 2011

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

sap
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

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



[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.

1 vote
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 8, 2011
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.
Nicolas Nicolas November 8, 2011

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?

sap
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

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.

0 votes
Roman Samorodov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 29, 2016

Hi all!

I had the same problem but finally I resolved it.

Steps to go:

  1. Install cntlm from HERE. 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>

0 votes
M Hoogenboom June 29, 2015

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.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...

0 votes
M Hoogenboom June 29, 2015

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.

0 votes
Abhishek Gupta June 9, 2015

I am facing exactly the same problem as Sunil. Please help.

0 votes
sunil1kr April 24, 2015

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
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. 

Abhishek Gupta June 9, 2015

I am facing exactly the same problem as Sunil. Please help.

0 votes
klang October 20, 2013

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..

0 votes
childnode August 29, 2013

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 ;/

0 votes
Janaksinh Mahida August 26, 2013

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. :)

0 votes
Simone Longoni May 3, 2012

Ramiro,

you are the One!

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

Thanks a lot,

Simone

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events