How can I add a maven repository that is only accessible via SSH?

(Dries De Smet) #1

I can now access my maven repository via the next snippet.

repositories {
  maven { url '' }

I already publish my maven artifacts to that repository via scp. Now I am trying to make that repository only accessible via SSH. In this way we could limit the access to the repository to only the people that publish their public key.

(Peter Niederwieser) #2

See “Example 52.4. Upload of file via SSH” in the Gradle User Guide. However, I think that ‘configuration = configurations.deployerJars’ has to be ‘addProtocolProviderJars(configurations.deployerJars)’.


The example Peter gave will allow uploading of artifacts via SSH. However, there is not currently any equivalent feature for resolving via SSH.

Getting this to work would involve adding another ‘RepositoryTransport’ implementation and wiring it in via URL. See FileTransport for an example.

If you’re interested in contributing this functionality, please let us know and we can help guide you through the process.

(Michał Knapik) #4

In maven, wagon works both for deploying and resolving. Is there any plan for supporting maven wagons for resolving?

If not, I might be interested in contributing.


No, we don’t plan on supporting Maven wagons for resolving. The Maven Wagon SSH provider implements resolution via SFTP and SCP.

As of Gradle 2.0, there is native support for SFTP-based resolution from a repository (ivy or maven). If you’d like to assist by contributing support for SCP-based resolution, that would be great.

(Michał Knapik) #6

Actually I need support for S3 protocol. I thought that if Gradle supported Maven wagons for resolving it would be a generic solution for both SSH and S3.

I’m using for publishing artifacts and it works flawlessly with Gradle. However uploading to S3 is pretty useless when it is not possible to resolve using the same protocol.