如何在grails中安装插件(Joda Time)>;2.3使用maven构建时
我正在使用Grails2.3.5,需要安装Joda Time插件,以利用标记库格式化日期 我使用命令创建了一个简单的grails应用程序:“grails创建应用程序测试应用程序” 然后,我通过执行:“grails create pom com.company”将其转换为使用maven pom 然后,我可以使用“mvn clean package”打包应用程序 现在,我希望能够加载joda time插件。如果我运行“grails插件信息joda time”,我会收到以下信息:如何在grails中安装插件(Joda Time)>;2.3使用maven构建时,maven,grails,jodatime,Maven,Grails,Jodatime,我正在使用Grails2.3.5,需要安装Joda Time插件,以利用标记库格式化日期 我使用命令创建了一个简单的grails应用程序:“grails创建应用程序测试应用程序” 然后,我通过执行:“grails create pom com.company”将其转换为使用maven pom 然后,我可以使用“mvn clean package”打包应用程序 现在,我希望能够加载joda time插件。如果我运行“grails插件信息joda time”,我会收到以下信息: ----------
--------------------------------------------------------------------------
Information about Grails plugin
--------------------------------------------------------------------------
Name: joda-time | Latest release: 1.4
--------------------------------------------------------------------------
Joda-Time Plugin
--------------------------------------------------------------------------
Author: Rob Fletcher
--------------------------------------------------------------------------
Author's e-mail: rob@freeside.co
--------------------------------------------------------------------------
Find more info here: http://gpc.github.com/grails-joda-time/
--------------------------------------------------------------------------
Joda Time integration for Grails
Dependency Definition
--------------------------------------------------------------------------
:joda-time:1.4
Required Repositories
--------------------------------------------------------------------------
http://plugins.grails.org
http://repo.grails.org/grails/plugins/
http://repo.grails.org/grails/core/
http://svn.codehaus.org/grails/trunk/grails-plugins
http://repo1.maven.org/maven2/
http://repo.grails.org/grails/libs-releases/
http://m2repo.spockframework.org/ext/
http://m2repo.spockframework.org/snapshots/
Transitive Dependencies
--------------------------------------------------------------------------
org.hamcrest:hamcrest-all:1.1 (test)
org.jodd:jodd-wot:3.3.1 (test)
我注意到上面的信息与插件()的网站不一致。该网站指出1.5版是最新版本,并且包含一个与Grails>2.3不兼容的安装命令。它还显示了一个无效的github位置,正确的位置似乎是
我将此插件包括在BuildConfig.groovy文件中,如下所示:
grails.project.dependency.resolution = {
...
plugins {
...
compile ":joda-time:1.4"
...
}
}
<dependencies>
...
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>joda-time</artifactId>
<version>1.4</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
</dependencies>
我还将依赖项包括在pom.xml中,如下所示:
grails.project.dependency.resolution = {
...
plugins {
...
compile ":joda-time:1.4"
...
}
}
<dependencies>
...
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>joda-time</artifactId>
<version>1.4</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
</dependencies>
...
org.grails.plugins
乔达时间
1.4
编译
拉链
当我执行“mvn包”时,grails(通过maven)获取并下载插件。但是,任何在groovy类中引用插件以访问FormattingTagLib类的尝试都会失败。我还尝试在joda时间信息页面中包含所有存储库以及可传递的依赖项,但无法让grails获取插件
有人可以帮助我让grails(尽管是maven)下载这个插件并使这些类可以访问,这样我就可以在groovy类中引用它们了
我无法更改Grails的版本来解决这个问题,我必须使用maven进行构建。右键单击pom.xml,然后选择第二次运行选项。然后运行这个命令“cleanstall”,将插件安装到maven存储库中。这对你有帮助。谢谢桑托什。我试过了。我还尝试清理整个缓存并重新填充它。我能得出的唯一结论是maven构建不支持Joda Time插件。我被迫将其作为依赖项删除。我有一个简单的grails项目,其中包含一个maven pom文件和测试用例。