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

**URL:** <https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649>\
**Category:** Old Forum Archive\
**Created:** [February 16, 2014, 11:13am UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649 "2014-02-16T11:13:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dries\_De\_Smet](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/dries_de_smet/32/1131_2.png) [@Dries\_De\_Smet](https://discuss.gradle.org/u/Dries_De_Smet)\
**Post date:** [February 16, 2014, 11:13am UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649/1 "2014-02-16T11:13:00Z")

</div>

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

```gradle
repositories {
  maven { url 'http://maven.domain.com/releases' }
}

```

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.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [February 16, 2014, 3:24pm UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649/2 "2014-02-16T15:24:00Z")

</div>

See “Example 52.4. Upload of file via SSH” in the [Gradle User Guide](http://gradle.org/docs/current/userguide/userguide_single.html). However, I think that ‘configuration = configurations.deployerJars’ has to be ‘addProtocolProviderJars(configurations.deployerJars)’.

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [February 17, 2014, 12:33am UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649/3 "2014-02-17T00:33:00Z")

</div>

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](https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/externalresource/transport/file/FileTransport.java) for an example.

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

---

<div class="post-metadata">

**Author:** ![Michal\_Knapik](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/michal_knapik/32/1458_2.png) [@Michal\_Knapik](https://discuss.gradle.org/u/Michal_Knapik)\
**Post date:** [July 2, 2014, 8:05am UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649/4 "2014-07-02T08:05:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [July 2, 2014, 1:49pm UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649/5 "2014-07-02T13:49:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michal\_Knapik](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/michal_knapik/32/1458_2.png) [@Michal\_Knapik](https://discuss.gradle.org/u/Michal_Knapik)\
**Post date:** [July 2, 2014, 1:53pm UTC](https://discuss.gradle.org/t/how-can-i-add-a-maven-repository-that-is-only-accessible-via-ssh/6649/6 "2014-07-02T13:53:00Z")

</div>

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 [https://github.com/spring-projects/aws-maven](https://github.com/spring-projects/aws-maven) 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.
