【问题标题】:How to add plugin dependencies to pom.xml如何将插件依赖项添加到 pom.xml
【发布时间】:2013-09-26 21:19:35
【问题描述】:

我在BuildConfig.groovy 中创建了一个插件,它具有其他插件作为插件依赖项:

grails.project.dependency.resolution = {
    ....
    plugins {
        build(":release:3.0.0",
            ":rest-client-builder:1.0.3") {
             export = false
        }

        // my dependencies
        compile ':spring-security-core:1.2.7.2'
        compile ":spring-security-ldap:1.0.6"
    }
}

如何确保当有人安装我的插件时,他们不必手动安装 spring-security-corespring-security-ldap?我希望依赖管理为他们做这件事。

Grails 2.3.0

【问题讨论】:

  • dependency-report 的应用程序使用您的插件应该向用户显示不手动安装的内容。

标签: grails grails-plugin


【解决方案1】:

您已经正确配置了它。不会安装 release 和 rest-client-builder builder 插件,因为它们被正确配置为不被导出,但安全插件被导出,因为默认情况下所有依赖项都被导出。

您可以通过运行grails generate-pom 并查看生成的pom.xml 文件来看到这一点。 jar 和插件依赖项位于 <dependencies> 块中,<dependency> 块中应该有任何可传递插件依赖项的“org.grails.plugins” groupId 条目。

【讨论】:

  • pom.xml 中的依赖块为空。它只有<dependencies />。我可能需要在插件描述符中使用dependsOn 吗?
  • 不,现在不使用dependsOn。你在generate-pom 之前运行过grails compile 吗?
  • 是的,我有(cleancompilegenerate-pom)。结果相同。这是一个示例插件,也许你可以看看我做错了什么:github.com/zoran119/dependency-test
  • 看起来像一个 Grails 错误,因为这在早期版本的 Grails 中运行良好。如果您不需要 2.3 的功能(开发插件时很少这样做),那么您可以降级到 2.0.x/2.1.x/2.2.x 并且它会工作。
  • 3.0.1版本插件修复
猜你喜欢
  • 2013-07-12
  • 2014-01-05
  • 1970-01-01
  • 1970-01-01
  • 2013-11-03
  • 1970-01-01
  • 2018-06-03
  • 2016-03-28
  • 1970-01-01
相关资源
最近更新 更多