如何使Gradle存储库指向本地目录 [英] How to make Gradle repository point to local directory

查看:71
本文介绍了如何使Gradle存储库指向本地目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因,我的离岸团队无法从我的客户Artifactory(这是我们组织的依赖项存储库)中下载工件(依赖项).刷新依赖项"不会触发任何操作,并给出超时异常.我看到我的"Gradle Dependencies"已下载到位置"D:/C813507/Gradle/gradle-1.11/bin/caches/modules-2/files-2.1/".我可以压缩该文件夹并发送给他们吗?他们如何在gradle中实现指向其本地目录的内容.我的构建gradle有以下行.如何将URL指向Windows操作系统中的本地目录

For some reason my offshore team is not able to Download the artifacts(Dependencies) from my clients Artifactory which is our Organizations dependency repository."Refresh Dependencies" triggers nothing and gives TIME OUT EXCEPTION. I see the that my "Gradle Dependencies" are downloaded to the location "D:/C813507/Gradle/gradle-1.11/bin/caches/modules-2/files-2.1/". Can i zip this folder and send over to them ? How do they implement something in gradle that points to their local directory. My build gradle has the following line. How to point the URL to local directory in Windows OS

repositories {
         maven {
            url 'http://artifactory.myorg.com:8081/artifactory/plugins-release'
        }

}

推荐答案

如果您不能授予离岸团队访问权限,则可以将所需的所有依赖项jar复制到单个目录中,然后使用 flatDir 存储库.

If you can't give access to your offshore team, you can copy all dependencies jar that needed to a single directory, and then use flatDir repository.

repositories {
   flatDir {
       dirs 'D:/path/to/local/directory'
   }
}


dependencies {
   compile name: 'name-of-jar'
}

不使用 flatDir 存储库的另一种方法是:

Another way without using flatDir repository is:

dependencies {
    compile files('/path/to/dir/something_local.jar')
}

这篇关于如何使Gradle存储库指向本地目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆