SyntaxHighlighter

Showing posts with label grails. Show all posts
Showing posts with label grails. Show all posts

Thursday, September 29, 2011

grails (un)install-plugin not cleaning up properly

It could be just me, but some plugins for grails don't work so well. For one of my grails projects, I had maven-publisher installed. When I saw that the release plugin is to replace maven-publisher plugin in the future, I thought I'd try it out. For the record, I had maven-publisher 0.8.1 installed. So, I did:
grails uninstall-plugin maven-publisher
grails install-plugin release
All seemed ok. It installed release plugin 1.0.0.RC3. There I tried this:
grails maven-install
It gave me this NPE bug:
java.lang.NullPointerException: Cannot get property 'file' on null object
Thankfully this bug was already logged and a patch attached too. See http://jira.grails.org/browse/GPRELEASE-23 for more details. Anyway, I decided to go back to the old maven-publisher for now. So I did:
grails uninstall-plugin release
grails install-plugin maven-publisher
Now, I was trying to maven-install again, and I get this error:
[...]
Dependencies resolved in 2207ms.
Running script /home/tlee/.grails/1.3.7/projects/myhumbleproject/plugins/maven-publisher-0.8.1/scripts/MavenInstall.groovy
Error executing script MavenInstall: No such property: releasePluginDir for class: MavenInstall
groovy.lang.MissingPropertyException: No such property: releasePluginDir for class: MavenInstall
	at MavenInstall.run(MavenInstall:17)
	at MavenInstall$run.call(Unknown Source)
	at gant.Gant.prepareTargets(Gant.groovy:606)
Error executing script MavenInstall: No such property: releasePluginDir for class: MavenInstall
I tried this:
grails clean
grails war
It asked if I wanted to uninstall svn-1.0.0.M1 which was installed by release plugin before. I said yes, and grails war script continues and builds the war file. I run:
grails maven-install
and I again get the same error as before. I tried removing entire $HOME/.ivy2/cache folder, and I still got the same error. And then, I tried removing entire $HOME/.grails/1.3.7/projects/myhumbleproject/ folder. Then:
grails maven-install
resulted in grails asking me back for clarification.
Running pre-compiled script
Script 'MavenInstall' not found, did you mean:
1) UninstallPlugin
2) InstallPlugin
3) InstallDependency
4) InstallTemplates
5) Init
Please make a selection or enter Q to quit: Q
Ha! Ok. I ran:
grails war
Then:
grails maven-install
Finally, it worked! It seems a compiled script remains even after uninstalling the release plugin.

Thursday, July 7, 2011

Groovy Date clearTime() method

Groovy has a nice Date class defined.
One I learned to use recently is clearTime() method.
Date today = new Date().clearTime()
This should result to today's date with no time component attached to it.

But, my code kept on failing.
So I dug around a bit, and found this: http://jira.codehaus.org/browse/GROOVY-4788

I was on groovy 1.7.3, because my project's on grails 1.3.7. As you can see on the jira page, at this version of groovy, clearTime() does not have a return value.

Watch out for it if you are stuck!

After thought: groovy 1.8 seem to have very nice improvements over previous versions of groovy. I hope grails 1.4 will get released soon!