I am trying to publish the Android library as a Maven artifact in the Bitbucket repository, starting with this article , which was related to the Android Weekly Newsletter release some time ago. This article describes how to publish and how to link the published artifact to another Android project. However, I was not even able to get part of the publication to work correctly.
This is currently the corresponding contents of the build.gradle file belonging to the library project:
apply plugin: 'maven' allprojects { repositories { jcenter() maven { url "https://raw.github.com/synergian/wagon-git/releases" } } } configurations { deployerJar } dependencies { deployerJar 'ar.com.synergian:wagon-git:0.2.5' }
The relevant parts of the library module build.gradle file in the project are as follows:
apply plugin: 'maven' uploadArchives { configuration = rootProject.configurations.archives repositories { configuration = rootProject.configurations.deployerJar mavenDeployer { pom.groupId = 'com.example' pom.artifactId = 'example-library' pom.version = '1.0.0' repository(url: "${bitbucketUrl}") { authentication(userName: bitbucketUsername, password: bitbucketPassword) } } } }
where bitbucketUrl , bitbucketUsername and bitbucketPassword are included in the gradle.properties file in the root of the project.
So what is the problem? When I run the uploadArchives task from Android Studio, Gradle shows that the operation completed successfully. But nothing appears in the Bitbucket repository.
Nothing has been written about the structure of this repository, except for the Wagon Git website (the call to its documentation seems a little stretched for me), where the specified URL of the form repository
git:releases:// git@github.com :synergian/wagon-git.git
states that releases represents a repository branch. I obligated this part about the structure even tried to add a repository directory (to mimic the local Maven repository on my machine), but no luck and, above all, there was no hint.
An even more serious problem is that when I experimented with different configurations, I noticed that my repository URL was incorrect; however, at runtime, Gradle never noticed an error, and warned or informed me of a suitable message. This made me suspect that he did not even prepare the artifact for download and did not try to connect to Bitbucket, but I could not find a pointer to understand why.
Finally, something even stranger happens: when I comment out a line:
configuration = rootProject.configurations.deployerJar
in the build.gradle module, and I run the uploadArchives task, Gradle stops with an error, stating that it canβt find the right universal for managing the Git protocol, which is expected; however, in this process, the Maven artifact appears in the local repository on my machine. Thus, if the publishing process fails, at least I can work locally with my library from other projects, depending on this, using Gradle to manage Maven dependencies.
What am I doing wrong?