0
votes

for few days I was trying to deploy a gradle project to Artifactory, but any of my attempts were successful!

I am using Artifactory 6.1.0 and gradle on eclipe the oxygen release

I created an admin user and a gradle repository in Artifactory

I added the code [from generate setting of the repository] to the build.gradle file and here's the content

//In fact I am not sure if I need all of them!?
apply plugin: 'java-library'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'

buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
    }
}

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

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'xyz_reposit'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
    resolve {
        repository {
            repoKey = 'gradle-dev'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId = 'myGroup'
            artifactId = 'myProject'
            version = '1.0.0'

            from components.java
        }
    }
}

and the gradle.properties is configured

artifactory_user=Admin
artifactory_password=password
artifactory_contextUrl=http://localhost:8081/artifactory

When I execute artifactoryDeploy from publishing here the result in the cmd

cmd message after executing deploy from eclipse

When I go back to Artifactory, nothing is published in the xyz repository!? would you please help me!? I am pretty sure that something is missing in the build.gradle code?!

2

2 Answers

0
votes

What gradle of version are you using? I recommend updating to the latest 5.4.1

Second, you should also have to do a gradlew artifactoryPublish after doing the artifactoryDeploy.

To see the difference in commands run:

gradlew tasks