一、错误详情
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':mediaplayer:compileReleaseAidl'.
> Could not resolve all task dependencies for configuration ':mediaplayer:releaseCompileClasspath'.
> Could not resolve com.aliyun.sdk.android:AliyunPlayer:5.4.6.0-full.
Required by:
project :mediaplayer
> Could not resolve com.aliyun.sdk.android:AliyunPlayer:5.4.6.0-full.
> Could not parse POM http://192.168.xx.xx:8081/repository/public/com/aliyun/sdk/android/AliyunPlayer/5.4.6.0-full/AliyunPlayer-5.4.6.0-full.pom
> Already seen doctype.
> Skipped due to earlier error
下载这个pom文件,可以看到它变成了html网页。
而正确的pom文件,应该是xml格式的文本。
二、问题排查
同样的座标,存在重复的包。
- 错误的包
查看pom详情
This page contains the following errors:
error on line 1 at column 27: AttValue: " or ' expected
Below is a rendering of the page up to the first error.
- 正确的包
查看pom详情
三、错误原因
1、问题分析
错误的pom文件地址是:http://192.168.xx.xx:8081/repository/spring-releases/com/aliyun/sdk/android/AliyunPlayer/5.4.6.0-full/AliyunPlayer-5.4.6.0-full.pom
正确的pom文件地址是:http://192.168.xx.xx:8081/repository/proxy_aliyun_nexus/com/aliyun/sdk/android/AliyunPlayer/5.4.6.0-full/AliyunPlayer-5.4.6.0-full.pom
对比二者的pom文件,可以发现以下不同:
- 时间不同:错误的Pom文件为最近缓存,正确的则是在去年甚至更早
- 上传者不同:错误的Pom文件为5.23机器,是最近打包的机器。
- 仓库Repository不同:错误的Pom文件其仓库为spring-releases,正确的则是proxy_aliyun_nexus
可以初步得出的结论是:
- 5.23机器在gradle打包的时候,没有走期望的仓库proxy_aliyun_nexus,而是spring-releases。
2、仓库spring-releases
配置了一个路由规则,见下:
什么是路由规则
Routes are like filters you can apply to groups in terms of security access and general component retrieval. They can be used to reduce the number of repositories within a group accessed in order to retrieve a component. For more information, check the documentation.
查看路由详情
BLOCK:
When a matcher compares with the request path, the request is blocked.
ALLOW:
When a matcher compares with the request path, the request is allowed.
3、解决办法
- 去掉仓库spring-releases的路由规则
- 修改路由规则
四、总结
nexus的路由规则还是慎用,个人建议是不需要使用。
起初是想要禁用nexus的swagger,拒绝访问接口“/service/rest/swagger.json”。
想通过路由规则来禁用swagger,无意间捅马蜂窝了,导致android打包的时候,pom全部无法访问。
于是出现了上文的问题。