A Gradle plugin that intercepts the publish task and replaces default deployment behavior with custom Harness deployment to Artifactory.
plugins {
id 'io.harness.gradle' version '1.0.0'
}plugins {
id("io.harness.gradle") version "1.0.0"
}If you want to apply the plugin to all subprojects, add this to your root build.gradle:
allprojects {
apply plugin: 'io.harness.gradle'
}allprojects {
apply(plugin = "io.harness.gradle")
}Add the harnesspublish configuration block to your build.gradle:
harnesspublish {
apiUrl = System.getenv("DEPLOY_REPO_URL")?: ""
username = System.getenv("DEPLOY_USERNAME")?: ""
token = System.getenv("DEPLOY_TOKEN")?: ""
}harnesspublish {
apiUrl = System.getenv("DEPLOY_REPO_URL")?: ""
username = System.getenv("DEPLOY_USERNAME")?: ""
token = System.getenv("DEPLOY_TOKEN")?: ""
}Before running the publish command, set the required environment variables You will get the values from the Harness UI 'Set Up client' section :
export DEPLOY_REPO_URL="https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/maven"
export DEPLOY_USERNAME="your-username"
export DEPLOY_TOKEN="your-token"set DEPLOY_REPO_URL=https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/maven
set DEPLOY_USERNAME=your-username
set DEPLOY_TOKEN=your-token$env:DEPLOY_REPO_URL="https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/maven"
$env:DEPLOY_USERNAME="your-username"
$env:DEPLOY_TOKEN="your-token"
## Configuration description
| Environment Variable | Description |
|------------------------|-------------|
| `DEPLOY_REPO_URL` | Repository URL for deployment |
| `DEPLOY_USERNAME` | Username for deployment |
| `DEPLOY_TOKEN` | Token/password for deployment |
| `DEPLOY_THREAD_COUNT` | threads for deployment |Execute the publish task:
./gradlew publishRefer to CONTRIBUTING.md
Apache License 2.0, see LICENSE.