Is there an API in stash for uploading a plugin via command line?

Does anyone have an example for doing this? It looks like we are going to have several customized plugins, so I'd like to automate the procedure for building and updating them on our production server.



1 answer

1 accepted

Hi Charles,

This looks exactly like what I'm looking for. I'm having problems getting it to work though. Here's a snippet. Note that our server is hosted at and we only have HTTPS on port 443 exposed.

$ atlas-install-plugin -e --http-port 443 --context-path / --username pickgr --password ***** --server --plugin-key com.atlassian.stash.stash-enforce-message-hook-plugin

Executing: /opt/atlassian-plugin-sdk/apache-maven/bin/mvn com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.1.6:install -e -Dhttp.port='443' -Dcontext.path='/' -Dusername='pickgr' -Dpassword='*****' -Dserver='' -Datlassian.plugin.key='com.atlassian.stash.stash-enforce-message-hook-plugin'

Warning: JAVA_HOME environment variable is not set.

+ Error stacktraces are turned on.

[INFO] Scanning for projects...

[INFO] ------------------------------------------------------------------------

[INFO] Building Enforce Commit Message Hook

[INFO] task-segment: [com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.1.6:install]

[INFO] ------------------------------------------------------------------------

[INFO] [amps-dispatcher:install]

[INFO] [stash:install {execution: virtual-execution}]

[INFO] [atlassian-pdk:install]

[INFO] Install Plugin: Couldn't get the token from upm. Headers. Falling back to legacy upload.

log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).

log4j:WARN Please initialize the log4j system properly.

[INFO] Install Plugin: Uploading 'stash-enforce-message-hook-plugin-1.1.jar' to server:

org.apache.commons.httpclient.HttpRecoverableException: org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the status line from the response: unable to find line starting with "HTTP"

at org.apache.commons.httpclient.HttpMethodBase.readResponse(

Hi Garret,

I can't be sure, but I wonder whether it's trying to connect via http over 443, rather than actually using https. What happens when you try:

atlas-install-plugin -e --username pickgr --password ***** --server  --plugin-key com.atlassian.stash.stash-enforce-message-hook-plugin--http-port 443 --context-path /

Otherwise this might be relevant.


Thank you Charles! Modifying the server option to use the full URL did the trick.

[INFO] Install Plugin: Uploading 'stash-enforce-message-hook-plugin-1.1.jar' to server:
[INFO] Install Plugin: Completed successfully[200].
[INFO] ------------------------------------------------------------------------

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,945 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you