grails - 如何从自定义 Artifactory 存储库中加载 grails 插件?

标签 grails grails-plugin artifactory

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/

相关文章:

grails - 如何右对齐grails表中的数字编辑值

grails - Gradle插件不适用于Grails 2.2.3

grails - 我应该使用哪个版本的Grails?

gradle - 在gradle中使用 Artifactory

grails - 使用 DSL 而不是 resource.xml 在 resources.groovy 中配置 CXF 服务

grails - Grails 3.3.3和3.3.4有什么区别?

grails - 搜索具有逗号分隔值的记录,其中包含给定列表中的任何元素

java - 在 grails 框架之外使用 grails 插件?

docker - 如何使用 docker v1 存储库

ssl - 登录 artifactory docker registry 时出现隧道连接失败错误