首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用maven-install导出Grails2.3.0中插件的传递依赖关系

如何使用maven-install导出Grails2.3.0中插件的传递依赖关系
EN

Stack Overflow用户
提问于 2013-09-25 04:24:20
回答 2查看 1.6K关注 0票数 1

在Grails2.3.0中,当我运行maven-install时,我的插件所依赖的插件不会被导出。这在2.2.3中起作用:

代码语言:javascript
复制
$ which grails
/Applications/grails-2.2.4/bin/grails
$ grails create-plugin myplugin
| Created plugin Myplugin
# add spring-security-core
$ cd myplugin; cat grails-app/conf/BuildConfig.groovy
...
  plugins {
    build(":tomcat:$grailsVersion",
          ":release:2.2.1",
          ":rest-client-builder:1.0.3") {
        export = false
    }
    compile ":spring-security-core:1.2.7.3"
  }
$ grails compile; grails maven-install
$ cat target/pom.xml|grep spring
  <artifactId>spring-security-core</artifactId>
$ cat ~/.m2/repository/org/grails/plugins/myplugin/0.1/myplugin-0.1.pom|grep spring
  <artifactId>spring-security-core</artifactId>

但在2.3.0中没有

代码语言:javascript
复制
$ which grails
/Applications/grails-2.3.0/bin/grails
$ grails create-plugin mynewplugin
| Created plugin Mynewplugin
# add spring-security-core
$ cd mynewplugin; cat grails-app/conf/BuildConfig.groovy
...
  plugins {
    build(":release:3.0.0",
          ":rest-client-builder:1.0.3") {
        export = false
    }
    compile ":spring-security-core:1.2.7.3"
  }
$ grails compile; grails maven-install
$ cat target/pom.xml|grep spring
$ cat ~/.m2/repository/org/grails/plugins/mynewplugin/0.1/mynewplugin-0.1.pom|grep spring
$

我的application.properties没有列出依赖项。我还尝试了从源代码构建的Grails 2.3.1,但它的性能与2.3.0相同。目标是能够拥有一个依赖于其他插件的插件,并将这些依赖项导出到主应用程序,而不需要主应用程序显式声明它们。这是可能的吗?如果是的话,我遗漏了什么?我读过很多其他相关的堆叠溢出答案和Grails邮件列表,但是没有什么能为我澄清这一点。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-09-26 15:07:43

对于任何努力解决这个问题的人来说,这都是发布插件3.0.0版本中的一个错误或遗漏。它是在3.0.1中修复的,因此将其添加到您的BuildConfig.groovy并重新运行maven-install解决了这个问题:

代码语言:javascript
复制
build(":release:3.0.1",...

以下是针对该bug的JIRA问题。

票数 1
EN

Stack Overflow用户

发布于 2013-09-25 11:33:14

在将我们的项目升级到使用Grails 2.3时,我也发现了这个问题。到目前为止,还没有发现原因,因为在某些情况下,生成的pom确实包含一些依赖项,但在大多数情况下并不是全部。然而,我发现了一项工作,它似乎让一切都可以建立起来:

  1. 在BuildConfig.groovy中添加use pom,以及grails.project.dependency.resolver = "maven"checksums truelegacyResolve false
  2. 在项目根目录中创建一个pom.xml。按需要人口。
  3. 将依赖项从BuildConfig.groovy移动到pom。插件的依赖定义(任何构建插件,我已经在提供的范围内定义了一次在Maven下): org.grails.plugins弹簧-安全性-核心1.2.7.3压缩 对于依赖项块中的条目: some.group伪影1.0.0
  4. 现在,执行grails maven-installgrails maven-deploy应该使用该pom并正确工作。我们已经将此与使用父pom和全局settings.groovy中的一些开关结合在一起,希望(在编写本报告时未经过测试)允许我们仍然内联。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18996190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档