Pablo
Pablo

Reputation: 2301

Use android dependency from Azure DevOps public artifact

I have a public artifact on Azure DevOps where I have an Android dependency. According to DevOps it says that to add it to the project I need

  1. Connect to feed
maven {
    url 'https://pkgs.dev.azure.com/mycompany/myproject/_packaging/myartifactfeed/maven/v1'
}
  1. Get the package
compile(group: 'mycompany.myproject', name: 'myartifactfeed', version: '0.1.0')

The problem is that when I run gradle build I get the following error

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not find mycompany.myproject:myartifactfeed:0.1.0.
     Required by:
         project :app

build.gradle

buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
        maven {
            url 'https://pkgs.dev.azure.com/mycompany/myproject/_packaging/myartifactfeed/maven/v1'
        }
    }
}

app/build.gradle

dependencies {
    ...
    compile(group: 'mycompany.myproject', name: 'myartifactfeed', version: '0.1.0')    
}

So how exactly sould I be importing my dependency from DevOps?

Upvotes: 1

Views: 1228

Answers (2)

Pablo
Pablo

Reputation: 2301

It seems that moving maven.url from buildscript to allprojects did work.

buildscript {
    repositories {
        // ...
        /* maven {
            url 'https://pkgs.dev.azure.com/mycompany/myproject/_packaging/myfeed/maven/v1'
        } */
    }
    // ...
}

allprojects {
    repositories {
        // ...
        maven {
            url 'https://pkgs.dev.azure.com/mycompany/myproject/_packaging/myfeed/maven/v1'
        }
    }
}

Upvotes: 0

Bright Ran-MSFT
Bright Ran-MSFT

Reputation: 13944

Firstly, make sure the specified dependency version you want to install is existing in the feed of Azure Artifacts on Azure DevOps.

Then you can reference to the following article to try installing the dependency from Azure Artifacts.

Upvotes: 0

Related Questions