Reputation: 15919
Hi I have a gradle android project that contains two library modules:
- MyProject
|-- LibA
|-- LibB
So LibB has a dependency to LibA. So the build.gradle file for LibB looks like this:
apply plugin: 'android-library'
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://$buildDir/repo")
pom.groupId = 'com.test.lib'
pom.version = '1.0'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.+'
compile project (':LibA')
}
As you see I would like to generate .aar files for each of my libraries modules in my gradle project. So far so good, but generating the pom.xml file with the correct dependency to LibA does not work like expected:
The pom.xml file for LibB looks like this:
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>19.+</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>MyProject</groupId>
<artifactId>LibA</artifactId>
<version>unspecified</version>
<scope>compile</scope>
</dependency>
Is there a way to specify how the maven dependency for LibA should look like in the generated pom file. How does other projects like ActionBar-PullToRefresh do that? For instance: ActionBar-PullToRefresh has an sub library module for Actionbar sherlock which has a dependency to :library the mail ActionBar-PullToRefresh library
Any suggestion?
Upvotes: 2
Views: 2233
Reputation: 9047
I'm not really into gradle, but I'd not use a dependency that points directly to the other project, but rather one that defines the group and artifact ids and the version of the artifact, like you do with the android support library.
So not
compile project (':LibA')
But rather
compile ('com.example.lib:LibA:1.2')
Edit: previously stated "compile project ('com.example.lib:LibA:1.2')", which was wrong. Thanks to Blundell to point that out.
Upvotes: 2