Skip to content

Instantly share code, notes, and snippets.

@jatin-lab49
Last active June 2, 2020 20:25
Show Gist options
  • Save jatin-lab49/228b5b27d0671f2da9e78529928d4246 to your computer and use it in GitHub Desktop.
Save jatin-lab49/228b5b27d0671f2da9e78529928d4246 to your computer and use it in GitHub Desktop.
TIL-Lab49/Upload Multiple Artifacts via Gradle

Upload Multiple file artifacts with one Gradle file

I ran into an issue where the deploy process needed to download multiple configuration files from artifactory. To upload these files to artifactory, I used the artifacts block in the build.gradle file as below:

project.group='com.lab49.example'
version='0.0.1-SNAPSHOT'

def devFile = file("./environments/dev/redirects.config.json")
def stageFile = file("./environments/stage/scripts/redirects.config.json")

artifacts {
    archives file: devFile, name: 'project-name-dev-config'
    archives file: stage, name: 'project-name-stage-config'
}

For a rootProject.name of configs, running the publish task uploaded the following artifacts into artifactory:

  • {artifactory-url}/{artifactory-libs-snapshot}/com/lab49/example/configs/0.0.1-SNAPSHOT/project-name-dev-config-0.0.1-SNAPSHOT.json
  • {artifactory-url}/{artifactory-libs-snapshot}/com/lab49/example/configs/0.0.1-SNAPSHOT/project-name-stage-config-0.0.1-SNAPSHOT.json
@kruttik-lab49
Copy link

Can you update the title of the gist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment