简体   繁体   中英

Grails Currencies Plugin: Unable to resolve class Money

I installed the grails currency plugin. I want to use the Money type in my grails domain class as such:

class FOO{
...
    Money lunchCost = new Money(amount:0.00, currency:'USD')
    Money dinnerCost = new Money(amount:0.00, currency:'USD')
...
}

I get an error when I compile saying "unable to resolve class Money". I traced the package heirchy of the Grails Money Plugin and tried to put in:

cr.co.arquetipos.currencies.Money breakfastCost = new cr.co.arquetipos.currencies.Money(amount:0.00, currency:'USD')

---- That didn't work either.

1) When I generated Foo, grails placed the domain class under "projectName.Foo" as it does for every domain class created. 2) I'm using Grails 1.3.5.

Do you have any ideas as to where the Currencies class is so I can include it in the "import <....Money> and get rid of this compilation error?

Same here: The plugin does not integrate with the Grails project, at all. Nevertheless, it has been installed to ${user.home}/.grails/1.3.5/projects/${project.name}/plugins/currencies-0.3 .

Since the plugin has been last updated in 2008 and doesn't cover too much functionality, I'd suggest to just copy the two domain classes (in the grails-app/domain folder) into your project.

For an evaluation, you may also want to have a brief look at grails-app/conf and test/integration in the plugin's installation folder.

Like ataylor says, don't use this plugin, it's broken. Instead use JScience. Checkout: Best practice to represent Money (value + currency) in Grails

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM