Sage Harpuia
Sage Harpuia

Reputation: 356

Gradle is not uploading artifact to artifactory

I'm trying upload a jar created with gradle, but I'm having troubles with it since I'm not familiar neither with gradle or artifactory.

Since this is an old project, is using Gradle 3.5.

This is what I added to the build.gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
}

artifactory {
    contextUrl = "xxxxxxxxx"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'repokey1'
            username = "xxxxxxx"
            password = "xxxxxx" 
        }
    }
    resolve {
        repository {
            repoKey = 'repokey2'
            username = "xxxxxx"
            password = "xxxxxx"  
        }
    }
}
apply plugin: "com.jfrog.artifactory"

when I run:

gradle artifactoryPublish

I get the following message:

Deploying build descriptor to: http://xxxxxxxx/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://xxxxxxx/artifactory/webapp/builds/my-project/1626816605048/2021-07-20T17:30:05.039-0400/

If I visit http://xxxxxxxx/artifactory/api/build I get a json with some metadata, but there is no jar to be found anywhere, Am I missing something?

Upvotes: 1

Views: 841

Answers (1)

yahavi
yahavi

Reputation: 6073

The Gradle Artifactory plugin should be told which publish configuration would be uploaded. In your case, you can add the default 'archives' configuration which collects all JARs:

artifactory {
    publish {
        ...
        defaults {
            publishConfigs('archives')
        }
    }
}

Notice - using publish configuration method is deprecated and users with newer Gradle versions should use Gradle publications.

Read more:

  1. Documentation
  2. Example

Upvotes: 1

Related Questions