我一直在尝试使用以下设置维护我的团队(Android开发)的构建服务器:
由于我无法控制的力量,服务器必须处于脱机状态。它连接到离线git仓库以获取我们的源代码。如果需要安装更新,我们可以获得临时的互联网访问,但是否则机器处于脱机状态。
然而,它已经很好地工作了很长时间(超过一年)。我们使用的模式是,如果我们更改依赖项(例如SDK或来自jcenter的库,例如'org.greenrobot:greendao:2.2.1'),那么我们将获得临时Internet访问,因此Gradle将下载依赖项,并且然后对于将来的离线构建,它使用缓存。
最近我们添加了一个新的依赖项('com.commonsware.cwac:merge:1.1。+'),它不是jcenter,而是https://s3.amazonaws.com/repo.commonsware.com的maven repo。
似乎存在或配置问题,或者与Jenkins一起阻止新的repo被缓存。
以下是我们的根build.gradle的相关剪辑:
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
}
}
以下是我们的应用build.gradle:
的剪辑dependencies {
compile 'com.android.support:multidex:1.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.greenrobot:greendao:2.2.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.commonsware.cwac:merge:1.1.+'
}
在Jenkins上构建时,如果有互联网访问权限,那么构建就可以了。 但是,如果没有互联网访问,它将因maven repo而失败:
java.net.ConnectException: Connection refused: connect
File C:\Users\ciandroid\.android\repositories.cfg could not be loaded.
Failed to download any source lists!
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not resolve com.commonsware.cwac:merge:1.1.+.
Required by:
My-App:app:unspecified
> Could not resolve com.commonsware.cwac:merge:1.1.+.
> Failed to list versions for com.commonsware.cwac:merge.
> Unable to load Maven meta-data from https://s3.amazonaws.com/repo.commonsware.com/com/commonsware/cwac/merge/maven-metadata.xml.
> Could not GET 'https://s3.amazonaws.com/repo.commonsware.com/com/commonsware/cwac/merge/maven-metadata.xml'.
> Connect to s3.amazonaws.com:443 [s3.amazonaws.com/52.216.0.27] failed: Connection refused: connect
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
如何配置它以缓存此其他仓库?我错过了什么?