不良丶青年 2017-07-16 04:56 采纳率: 0%
浏览 2276

android studio 生成maven 多个module依赖问题

我有一个工程 叫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生成依赖的问题,可是不知道怎么改,求帮忙。万分感激

  • 写回答

2条回答 默认 最新

  • zqbnqsdsmd 2018-07-30 16:15
    关注
    评论

报告相同问题?

悬赏问题

  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊