chalice 2.3.10
我编写了一个 Grails 插件供我公司使用,并安装在公司的 Artifactory 存储库中。如何设置另一个项目的 BuildConfig 以便在安装插件时检查公司的私有(private) Artifactory 存储库?
这是我尝试过的:
repositories {
...
grailsRepo "http://artifactory.mycompany.com/"
}
并且...
repositories {
...
mavenRepo "http://artifactory.mycompany.com/"
}
这些似乎都没有任何效果。更改或添加到 grails 插件仓库的正确配置是什么?
理想情况下,我希望同时检查自定义仓库和 grails 中央仓库的插件。
编辑:
进一步澄清...我希望我的项目配置为下拉仅存在于公司的 Artifactory 服务器上的插件,而不是中央 Grails 插件存储库中的插件。
我从 grails compile 得到以下输出:
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins)
根据构建输出,似乎没有访问公司服务器。
最佳答案
这是我的做法。插件的 BuildConfig.groovy:
grails.project.dependency.distribution = {
remoteRepository(id: "localPluginReleases", url: "http://localhost:8081/artifactory/plugins-release-local/")
remoteRepository(id: "localPluginSnapshots", url: "http://localhost:8081/artifactory/plugins-snapshot-local/")
}
然后将该插件与以下内容打包在一起:
grails publish-plugin --allow-overwrite --noScm --repository=localPluginReleases
应用程序的 BuildConfig.groovy:
grails.project.dependency.resolution = {
repositories {
mavenRepo "http://localhost:8081/artifactory/plugins-snapshot-local/"
mavenRepo "http://localhost:8081/artifactory/plugins-release-local/"
// other stuff
}
}
关于grails - 如何从自定义 Artifactory 存储库中加载 grails 插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25555415/