Android maven插件生成pom.xml
嗨,我有一个gradle android项目,它包含两个库模块:Android maven插件生成pom.xml,android,maven,gradle,android-studio,Android,Maven,Gradle,Android Studio,嗨,我有一个gradle android项目,它包含两个库模块: - MyProject |-- LibA |-- LibB 所以LibB依赖于LibA。因此LibB的build.gradle文件如下所示: apply plugin: 'android-library' apply plugin: 'maven' uploadArchives { repositories { mavenDeployer { repository(url: "f
- MyProject
|-- LibA
|-- LibB
所以LibB依赖于LibA。因此LibB的build.gradle文件如下所示:
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')
}
<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>
如您所见,我希望为gradle项目中的每个库模块生成.aar文件。到目前为止还不错,但是生成对LibA具有正确依赖关系的pom.xml文件并不像预期的那样工作:
LibB的pom.xml文件如下所示:
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')
}
<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>
com.android.support
有什么建议吗?我不是很喜欢gradle,但我不会使用直接指向其他项目的依赖项,而是定义组和工件ID以及工件版本的依赖项,就像使用android支持库一样
所以不是
compile project (':LibA')
而是
compile ('com.example.lib:LibA:1.2')
编辑:前面提到的“编译项目('com.example.lib:LibA:1.2'),这是错误的。感谢Blundell指出这一点。看起来类似于您不能声明对本地模块的依赖关系,即使用组和版本的LibA
,它本质上是未版本的