我对使用 gradle 和 springframework 都很陌生。
如何在不使用任何外部存储库(包括本地 Maven 存储库)的情况下使用 springframework 作为 gradle 插件?即只需使用下载的 springframework 文件,将它们放在我的本地目录中并告诉 gradle 引用它们。
最佳答案
您可能正在寻找Flat directory repository :
Some projects might prefer to store dependencies on a shared drive or as part of the project source code instead of a binary repository product.
例如,在 build.gradle
中添加:
repositories {
flatDir {
dirs 'lib'
}
flatDir {
dirs 'lib1', 'lib2'
}
}
This adds repositories which look into one or more directories for finding dependencies. Note that this type of repository does not support any meta-data formats like Ivy XML or Maven POM files. Instead, Gradle will dynamically generate a module descriptor (without any dependency information) based on the presence of artifacts. However, as Gradle prefers to use modules whose descriptor has been created from real meta-data rather than being generated, flat directory repositories cannot be used to override artifacts with real meta-data from other repositories. For example, if Gradle finds only jmxri-1.2.1.jar in a flat directory repository, but jmxri-1.2.1.pom in another repository that supports meta-data, it will use the second repository to provide the module.
关于java - 如何仅使用本地目录作为存储库在 gradle 上设置 springframework?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51784883/