【问题标题】:Is there a plugin for Excel import for grails 2.2.0?是否有用于 grails 2.2.0 的 Excel 导入插件?
【发布时间】:2017-03-09 20:07:37
【问题描述】:

是否有用于 grails 2.2.0 的 Excel 导入插件?我尝试使用http://grails.org/plugin/excel-import,但它显示以下错误:

...\services\org\grails\plugins\excelimport\ExcelImportService.groovy: 4:无法解析类组织。 joda.time.LocalDate @ 第 4 行,列 1.导入org.joda.time.LocalDate^1错误

这里是 BuildConfig.groovy 的部分

    repositories {

        ...

    mavenRepo "http://repo.grails.org/grails/libs-releases/"
    mavenRepo "http://m2repo.spockframework.org/ext/"
    }
    plugins {
      compile ":excel-import:1.0.0"
      ...
   }

感谢任何帮助。

【问题讨论】:

  • 插件页面显示支持 Grails 2.0.0+。你的 BuildConfig.groovy 是什么样的?
  • 我已经在 BuildConfig.groovy 中加入了 compile ":excel-import:1.0.0"
  • Raanan 的回答是为什么我想看看你的 BuildConfig.groovy 中有什么。如果您还没有添加这两行,请添加。
  • @rmlan 我已经编辑了我的问题

标签: excel grails grails-2.2


【解决方案1】:

确保您添加了额外的依赖库:

mavenRepo "http://repo.grails.org/grails/libs-releases/"
mavenRepo "http://m2repo.spockframework.org/ext/"

到 BuildConfig 中的 maven repo 部分。似乎找不到它需要的依赖项(在这种情况下是 JodaTime) 希望对您有所帮助。

【讨论】:

  • 事实上我已经这样做并编辑了我的问题,但没有解决错误。
  • 检查插件源(github.com/jbarmash/grails-excel-import),它没有定义 Joda Time 依赖,但需要它(ExcelImportService.goorvy)。尝试将 Joda Time ass 添加为(maven)依赖项,看看它是否有效。缺少 LocalDate 类,应该在类路径中的某个位置
  • 谢谢我找到了解决办法。
【解决方案2】:

以防万一有人需要。 当我在 grails 2.4.4 上遇到同样的麻烦时,我使用 在我的 buildconfig 中:编译 ":excel-import:2.0.0.BUILD-SNAPSHOT"

【讨论】:

    【解决方案3】:

    我在 application.properties 中添加了plugins.joda-time=1.3.1,它现在可以工作了,我在这里找到了解决方案http://jonpolaski.blogspot.com/2013/04/grails-2x-excel-import-via-file-upload.html

    【讨论】:

      【解决方案4】:

      您可以将以下内容添加到依赖项中以获取 jodatime:

      compile "org.jadira.usertype:usertype.jodatime:1.9"
      

      但是,excel-import:1.0.0 仍然存在问题

      该导入使用了已弃用的类,并且无法使用 grails 2.4 进行编译

      您可以在 Git 上找到一个名为 excel-import:1.0.1 的版本。有人知道怎么安装吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-02-27
        • 2016-05-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-26
        • 1970-01-01
        相关资源
        最近更新 更多