This guide implies that you are using simple security model that is based on uniqueness of URLs. If you are using HTTP Basic Auth then please read a corresponding guide
Help / Configuring Gradle build file
Security
By default our service uses very simple security model - we create unique read/write URL for each user.
But this approach has its limitations - anyone who knows your URL can access your data. Because of that putting those URLs in to your build.gradle
file directly will be insecure.
To solve this problem you can store repository URL in ~/.gradle/gradle.properties
as we do in examples below.
Get more info: official documentation, stackoverflow question
Reading
To get data from your repository you can use read or write URLs. Add myMavenRepoReadUrl=${repositoryURL}
to file ~/.gradle/gradle.properties
where ${repositoryURL}
is read or write URL of your repository.
After that you can configure your repository in /path/to/project/build.gradle
file:
repositories { maven { url myMavenRepoReadUrl } }
Publishing artifacts
To publish data to repository you can use only write URL.
Add myMavenRepoWriteUrl=${writeURL}
to file ~/.gradle/gradle.properties
where ${writeURL}
is write URL of your repository.
After that modify /path/to/project/build.gradle
to configure publish task:
apply plugin: 'maven-publish' group = 'com.my-project' version = '0.1-SNAPSHOT' publishing { repositories { maven { url myMavenRepoWriteUrl } } publications { maven(MavenPublication) { from components.java } } }
Replace com.my-project
, 0.1-SNAPSHOT
with your data.
To upload artifacts use gradle publish
command.
maven
plugin to upload your dataGet more info: maven-publish plugin doc, maven plugin doc, blog post