我有一个工程 叫xxx_Libray,里边有2个module 分别为lib1、bli2 。lib2依赖lib1。编译lib2的gradle生成的pom文件格式如下:
<dependency>
<groupId>xxx_Libray</groupId>//这里groupId 和 version 有问题
<artifactId>lib1</artifactId>
<version>unspecified</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>design</artifactId>
<version>23.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>recyclerview-v7</artifactId>
<version>23.+</version>
<scope>compile</scope>
</dependency>
在使用依赖的项目里
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'xxx.xxx.xxx:1.0'
}
提示Error:Failed to resolve: XXX_Libray:lib1:unspecified
maven_push.gradle
apply plugin: 'maven'
apply plugin: 'signing'
configurations {
deployerJars
}
repositories {
mavenCentral()
}
// 判断版本是Release or Snapshots
def isReleaseBuild() {
return !VERSION.contains("SNAPSHOT");
}
// 获取仓库url
def getRepositoryUrl() {
return isReleaseBuild() ? RELEASE_URL : SNAPSHOT_URL;
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
pom.version = VERSION
pom.artifactId = POM_ARTIFACT_ID
pom.groupId = GROUP
repository(url: getRepositoryUrl()) {
authentication(userName: NAME, password: PASSWORD) // maven授权信息
}
}
}
}
// 进行数字签名
signing {
// 当 发布版本 & 存在"uploadArchives"任务时,才执行
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
我觉得是pom生成依赖的问题,可是不知道怎么改,求帮忙。万分感激