【问题标题】:Upgrading from Grails 2.0.3 to 2.2.1: Server access Error: Connection refused从 Grails 2.0.3 升级到 2.2.1:服务器访问错误:连接被拒绝
【发布时间】:2013-03-14 13:17:05
【问题描述】:

作为我的 Happy Trails 应用程序的一部分,我正在尝试从 Grails 2.0.3 升级到 2.2.1。

https://github.com/jamesward/happytrails/tree/grails2

我遇到的第一件事就是让 Geb/Spock 与 Groovy 2 一起工作。我在尝试安装插件或执行任何操作时遇到以下错误。

| Resolving plugin JAR dependencies
| Error WARNING: Dependencies cannot be resolved for plugin [mail] due to error: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/mraible/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-1.8.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-1.8 is not compatible with Groovy 2.0.7. For more information, see http://versioninfo.spockframework.org

我能够使用spock instructions for Grails 2.2 解决此问题。

但是,现在我遇到了一个奇怪的错误,Grails 似乎正在尝试从本地存储库下载文章。

$ grails compile
| Configuring classpath
:: problems summary ::
:::: ERRORS
    Server access Error: Connection refused url=http://localhost:8081/artifactory/plugins-releases-local/org/codehaus/geb/geb-spock/0.9.0-RC-1/geb-spock-0.9.0-RC-1.pom
    Server access Error: Connection refused url=http://localhost:8081/artifactory/plugins-releases-local/org/codehaus/geb/geb-spock/0.9.0-RC-1/geb-spock-0.9.0-RC-1.jar
| Error Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):

- org.codehaus.geb:geb-spock:0.9.0-RC-1

到目前为止,这是我的项目的差异:

https://gist.github.com/mraible/5161209

【问题讨论】:

  • 检查geb grails example pull request。这会将示例升级到 2.2。
  • 你能运行dependency-report 命令吗?如果是这样,请在依赖项中查找“geb-spock”​​。 Grails 在错误的包中寻找它(org.codehaus.geb 是旧包),这表明一些过时的依赖缓存信息。
  • 尝试将 'legacyResolve true' 添加到 grails.project.dependency.resolution 闭包中。只是为了确保它与新的解析器无关。

标签: grails grails-plugin spock geb


【解决方案1】:

既然我已经查看了该项目的源代码,我将提供另一个建议:从 application.properties 中删除所有插件条目,并将您需要的条目添加到 BuildConfig.groovy

我认为这里最大的问题是 geb 0.7.0 在 application.properties 中声明,而 0.9.0-RC-1 在 BuildConfig.groovy 中。您不需要svn 插件条目,因此不要将其添加到BuildConfig.groovy。您必须将 Searchable 插件升级到 0.6.4。

【讨论】:

  • 服务器访问错误:连接被拒绝似乎是由rateable插件引起的。当我在其自定义存储库中看到 localhost 时,我怀疑这一点。 grails.org/plugins/rateable 这在 2.0.3 中有效。无论如何要在 2.2 中抑制这个错误?
  • 原来是由于两次在 BuildConfig.groovy 中有 geb-spock 造成的。一次使用旧包名,一次使用新包名。删除旧的让我解决了这个问题。
  • 将以下行更改为 inherits false 应该可以解决存储库问题:github.com/jamesward/happytrails/blob/grails2/grails-app/conf/…
【解决方案2】:

我不能为了爱和金钱而复制,但我会冒险猜测你在 Ivy 缓存中有过时的依赖信息。尝试将~/.grails/ivy-cache 移动到/var/tmp 并运行grails compile。如果可行,您可以保持原样,或者恢复旧缓存并删除与 geb 相关的目录:

  • ~/.grails/ivy-cache/org.codehaus.geb
  • ~/.grails/ivy-cache/org.gebish
  • ~/.grails/ivy-cache/org.grails.plugins/geb

【讨论】:

    【解决方案3】:

    尝试删除(重命名)~/.grails/2.2.1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-08
      • 2015-01-27
      • 2017-04-28
      • 1970-01-01
      • 2016-09-12
      • 1970-01-01
      • 2017-01-10
      相关资源
      最近更新 更多