Jcenter更改groupId和artifactId的注意事项

近期由于以前的域名废弃不用,需要将sdk的包名替换成新的域名。
sdk使用novoda上传,配置如下:

publish {
    userOrg = 'ddnosh'
    groupId = 'la.xiong.androidquick'
    artifactId = 'AndroidQuick'
    version = '2.0.0'
    description = 'AndroidQuick is a code library contains quicker kits.'
    website = "https://github.com/ddnosh/AndroidQuick"
}

如果我们只修改groupId,比如:

publish {
    userOrg = 'ddnosh'
    groupId = 'com.androidwind'
    artifactId = 'AndroidQuick'
    version = '2.0.0'
    description = 'AndroidQuick is a code library contains quicker kits.'
    website = "https://github.com/ddnosh/AndroidQuick"
}

这样虽然能够上传成功,但是引用的时候会发现在JCenter中一直找不到这个库:

implementation ‘com.androidwind:AndroidQuick:2.0.0’

正确的方法是修改artifactId的值:

publish {
    userOrg = 'ddnosh'
    groupId = 'com.androidwind'
    artifactId = 'androidquick'
    version = '2.0.0'
    description = 'AndroidQuick is a code library contains quicker kits.'
    website = "https://github.com/ddnosh/AndroidQuick"
}

artifactId值不同,JCenter会新建一个library,我们直接依赖这个新的库即可:

implementation ‘com.androidwind:androidquick:2.0.0’

猜你喜欢

转载自blog.csdn.net/ddnosh/article/details/100694318