0

I am trying to add a dependency from my private BitBucket account using the BitBucket API following the accepted answer to this SO post.

My project root level build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}'
        }
        credentials {
            username 'my_username'
            password 'my_password'
        }
    }
}

I get the following error:

Error:(21, 0) Gradle DSL method not found: 'credentials()'
Possible causes:
    - The project 'USPLibraryClerk' may be using a version of Gradle that does not contain the method.
    - The build file may be missing a Gradle plugin.

If I move the credentials {} to inside the maven {} block, nothing seems to update in terms of getting my repo.

maven {
    url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}'
    credentials {
        username 'my_username'
        password 'my_password'
    }
}

How do I fix this error message?

kRiZ
  • 2,320
  • 4
  • 28
  • 39

1 Answers1

2

You can use somenthing like this:

repositories {
        jcenter()
        maven {
            credentials {
                username 'xxxx'
                password 'xxxx'
            }
            url 'http://xxxxxxxx/repositories/releases/'
        }
  }

Here the official doc.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • I have already tried that, see later part of my question. The message does go away, but nothing appears to be fetched. – kRiZ Sep 21 '15 at 13:02
  • @kRiZ It is the official syntax. You should check the issue in other part of your script. What do it mean nothing appear to be fetched? – Gabriele Mariotti Sep 21 '15 at 13:06