Failing to upload a local aar file to artifactory using gradle

412 Views Asked by At

I have a simple problem which I have not been able to solve. I have downloaded an external .aar file that I want to upload to our in house Artifactory. But I havent been able to solve the problem at all. Here is my build.gradle file

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'digital.wup:android-maven-publish:3.6.2'
    }
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'digital.wup.android-maven-publish'

group 'com.hello'

def version = '3.1'
def groupA = 'com.hello'
def artifactA = 'world'
def intermediateDirName = 'outputs/aar'

def aarFileLocation = "${buildDir}/${intermediateDirName}/${artifactName}-${datadogVersion}.aar"

configurations {
    aarLocal
}

dependencies {
    
   aarLocal files('world-3.1.aar')

}

task copyFromLocal(type: Copy) {
    from configurations.aarLocal
    into "$buildDir/$intermediateDirName"
}

publishToMavenLocal.dependsOn copyFromLocal
publish.dependsOn copyFromLocal

publishing {
  publications {
    publishAarToArtifactory(MavenPublication) {
        groupId groupName
        artifactId artifactName
        version datadogVersion
        artifact "${buildDir}/${intermediateDirName}/${artifactName}-${version}.aar"
    }
  }
}

publishToMavenLocal works w/o any problems but the publish task gets skipped Following is the error message I get Skipping task ':publish' as it has no actions. Any help? Basically uploading a local aar to artifactory is all that i am trying to achieve. NOTE : The repo credentials are in our CI/CD system for artifactory.

1

There are 1 best solutions below

0
On

Both publishToMavenLocal and publish are aggregate tasks without actions. They are used to trigger a bunch of publishPubNamePublicationToMavenLocal tasks and publishPubNamePublicationToRepoNameRepository tasks respectively.

$ ./gradlew publishToMavenLocal --info
...
> Task :publishMavenPublicationToMavenLocal
...
> Task :publishToMavenLocal
Skipping task ':publishToMavenLocal' as it has no actions.
:publishToMavenLocal (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.

$ ./gradlew publish --info
...
> Task :publishMavenPublicationToMavenRepository
...
> Task :publish
Skipping task ':publish' as it has no actions.
:publish (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.

Reference: https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:tasks