STS - Can't Find Grails Library - grails

I am porting over Grails project to STS and I don't know much about the project nor about STS, so I am a little lost. Also of note is that the project was previously in Grails 1.0.3 and I am upgrading it to 1.3.7.
After loading in the existing code, I configured my project to use Grails 1.3.7. When I attempt to build the project I get a bunch of errors relating to what appears to be just basic grails code that should come with 1.3.7:
e.g. Groovy:unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
Also, when I open STS I am asked to run an "upgrade" for grails, which fails with the following:
Command terminated with an error code (see details for output)
------System.out:-----------
Welcome to Grails 1.3.7 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /home/devon/springsource/grails-1.3.7/
Base Directory: /home/devon/Documents/Source/trunk
Resolving dependencies...
Dependencies resolved in 2458ms.
Running script /home/devon/springsource/grails-1.3.7/scripts/Compile.groovy
Environment set to development
Setting non-interactive mode
[groovyc] Compiling 110 source files to /home/devon/.grails/1.3.7/projects/trunk/classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] Compile error during compilation with javac.
[groovyc] /tmp/groovy-generated-1742177078522700179-java-source/com/pps/domain/User.java:62: package org.grails.plugins.springsecurity.service does not exist
[groovyc] public org.grails.plugins.springsecurity.service.AuthenticateService getAuthenticateService() { return (org.grails.plugins.springsecurity.service.AuthenticateService)null;}
[groovyc] ^
[groovyc] /tmp/groovy-generated-1742177078522700179-java-source/com/pps/domain/User.java:63: package org.grails.plugins.springsecurity.service does not exist
[groovyc] public void setAuthenticateService(org.grails.plugins.springsecurity.service.AuthenticateService value) { }
[groovyc] ^
[groovyc] /home/devon/Documents/Source/trunk/src/java/com/pps/util/MarketplaceWidgetUtils.java:24: warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in a future release
[groovyc] import sun.misc.BASE64Encoder;
[groovyc] ^
[groovyc] /tmp/groovy-generated-1742177078522700179-java-source/com/pps/domain/User.java:62: package org.grails.plugins.springsecurity.service does not exist
[groovyc] public org.grails.plugins.springsecurity.service.AuthenticateService getAuthenticateService() { return (org.grails.plugins.springsecurity.service.AuthenticateService)null;}
[groovyc] ^
[groovyc] /home/devon/Documents/Source/trunk/src/java/com/pps/util/MarketplaceWidgetUtils.java:170: warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in a future release
[groovyc] BASE64Encoder encoder = new BASE64Encoder();
[groovyc] ^
[groovyc] /home/devon/Documents/Source/trunk/src/java/com/pps/util/MarketplaceWidgetUtils.java:170: warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in a future release
[groovyc] BASE64Encoder encoder = new BASE64Encoder();
[groovyc] ^
[groovyc] 3 errors
[groovyc] 3 warnings
[groovyc]
[groovyc]
[groovyc] 1 error
Compilation error: Compilation Failed
------System.err:-----------
In my Java Build Path I have a 'Grails Dependencies' folder, but I don't know how to change it to make sure it is pointing to the right dependencies. There is also 'Groovy Libraries' and a bunch of random '.jar' dependencies.
What am I doing wrong?

It looks like it wasn't finding it because required dependencies to plugins were not resolving correctly. Once I got the plugins it worked correctly.

Related

Getting unable to resolve class org.apache.commons.configuration.PropertiesConfiguration

Iam new to groovy on grails.
In my grails application i have to edit a property file without deleting other key values for that Iam using apache commons following code
PropertiesConfiguration conf = new PropertiesConfiguration("config.properties");
props.setProperty("key", "value");
conf.save();
In BuildConfig.groovy I have included the depentencies
dependencies {
compile 'org.apache.commons:commons-configuration2:2.2'
compile 'org.apache.commons:commons-lang3:3.1'
}
While executing grails compile the dependencies seems to be downloaded without any error, but that Iam getting the compilation error
unable to resolve class org.apache.commons.configuration.PropertiesConfiguration
[groovyc] # line 5, column 1.
[groovyc] import org.apache.commons.configuration.PropertiesConfiguration;
[groovyc] ^
[groovyc]
What additional settings that i need to do in grails please suggest
Use
import org.apache.commons.configuration2.PropertiesConfiguration;
Note the 2 at the end of configuration!

Notifications plugin - what to use

Which is the best plugin available for sending notifications on the Grails application. I tried to use the notification plugin compile ":notifications:0.2.6" but while running it is showing error-:
|Loading Grails 2.5.0
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
|Installing zip notifications-0.2.6.zip...
...
|Installed plugin notifications-0.2.6
.....................
|Compiling 122 source files
Note: C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\scaffolding-2.1.2\src\java\org\codehaus\groovy\grails\scaffolding\AbstractGrailsTemplateGenerator.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details. [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\MailManager.groovy: 7: unable to resolve class org.codehaus.groovy.grails.commons.ApplicationHolder
[groovyc] # line 7, column 1.
[groovyc] import org.codehaus.groovy.grails.commons.ApplicationHolder
[groovyc] ^
[groovyc]
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\MailManager.groovy: 5: unable to resolve class grails.plugin.mail.MailService
[groovyc] # line 5, column 1.
[groovyc] import grails.plugin.mail.MailService
[groovyc] ^
[groovyc]
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\MailManager.groovy: 12: unable to resolve class grails.plugin.mail.MailService
[groovyc] # line 12, column 3.
[groovyc] private MailService service
[groovyc] ^
[groovyc]
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\config\NotificationUtils.groovy: 3: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
[groovyc] # line 3, column 1.
[groovyc] import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
[groovyc] ^
[groovyc]
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\custom\CustomMailNotification.groovy: 7: unable to resolve class org.codehaus.groovy.grails.commons.ApplicationHolder
[groovyc] # line 7, column 1.
[groovyc] import org.codehaus.groovy.grails.commons.ApplicationHolder
[groovyc] ^
[groovyc]
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\custom\CustomMailNotification.groovy: 6: unable to resolve class grails.plugin.mail.MailService
[groovyc] # line 6, column 1.
[groovyc] import grails.plugin.mail.MailService
[groovyc] ^
[groovyc]
[groovyc] C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\custom\CustomMailNotification.groovy: 13: unable to resolve class grails.plugin.mail.MailService
[groovyc] # line 13, column 3.
[groovyc] private MailService service
[groovyc] ^
[groovyc]
[groovyc] 7 errors
.Error
|
Compilation error: startup failed:
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\MailManager.groovy: 7: unable to resolve class org.codehaus.groovy.grails.commons.ApplicationHolder
# line 7, column 1.
import org.codehaus.groovy.grails.commons.ApplicationHolder
^
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\MailManager.groovy: 5: unable to resolve class grails.plugin.mail.MailService
# line 5, column 1.
import grails.plugin.mail.MailService
^
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\MailManager.groovy: 12: unable to resolve class grails.plugin.mail.MailService
# line 12, column 3.
private MailService service
^
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\config\NotificationUtils.groovy: 3: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
# line 3, column 1.
import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
^
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\custom\CustomMailNotification.groovy: 7: unable to resolve class org.codehaus.groovy.grails.commons.ApplicationHolder
# line 7, column 1.
import org.codehaus.groovy.grails.commons.ApplicationHolder
^
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\custom\CustomMailNotification.groovy: 6: unable to resolve class grails.plugin.mail.MailService
# line 6, column 1.
import grails.plugin.mail.MailService
^
C:\Users\DELL-PC\git\haribol-part2\tearp\target\work\plugins\notifications-0.2.6\src\groovy\pt\whiteroad\plugins\notifications\custom\CustomMailNotification.groovy: 13: unable to resolve class grails.plugin.mail.MailService
# line 13, column 3.
private MailService service
^
7 errors
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
The notifications plugin is quite old and presumably is not compatible with the version of Grails you are using. Try the mail plugin https://grails.org/plugin/mail

Compile error with grails 2.4.1 and plugin joda-time 1.5

When compiling a grails 2.4.1 project I get the following error:
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] /home/omarques/ws1/sigob/target/work/plugins/joda-time-1.5/src/groovy/grails/plugin/jodatime/simpledatastore/SimpleMapJodaTimeMarshaller.groovy: 44: Apparent variable 'MonthDay' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
[groovyc] You attempted to reference a variable in the binding or an instance variable from a static context.
[groovyc] You misspelled a classname or statically imported field. Please check the spelling.
[groovyc] You attempted to use a method 'MonthDay' but left out brackets in a place not allowed by the grammar.
[groovyc] # line 44, column 87.
[groovyc] me, LocalDate, LocalDateTime, MonthDay,
[groovyc] ^
I've tried to upgrade the project to 2.4.3 and got the same error
Add the following to application.properties and try
plugins.joda-time=1.3.1
the problem was solved by including on BuildConfig an explicit dependency to joda-time-2.3 because another dependency(net.objectlab.kit:datecalc-joda:1.2.0) was causing the use of an outdated version of joda-time that is incompatible with the joda-time grails plugin

Compile error in Grails ehcache plugin

Have just added to BuildConfig.groovy:
compile ":cache-ehcache:1.0.1"
I'm using Eclipse/Spring Tool Suite v 3.5.0.RELEASE
JAVA_HOME set to: E:\Program Files\Java\jdk1.7.0_17
I get the following compilation errors when I run grails runApp.
Compilation error: startup failed:
Compile error during compilation with javac.
C:\Documents and Settings\pagendg\.grails\2.3.8\projects\osrpms\plugins\cache-ehcache-1.0.1\src\java\grails\plugin\cache\ehcache\GrailsEhCacheManagerFactoryBean.java:195: error: ReloadableCacheManager.ProxyEhcache is not abstract and does not override abstract method getSearchesPerSecond() in Ehcache
protected class ProxyEhcache implements Ehcache {
^
C:\Documents and Settings\pagendg\.grails\2.3.8\projects\osrpms\plugins\cache-ehcache-1.0.1\src\java\grails\plugin\cache\ehcache\GrailsEhCacheManagerFactoryBean.java:798: error: getStatistics() in ReloadableCacheManager.ProxyEhcache cannot implement getStatistics() in Ehcache
public StatisticsGateway getStatistics()
^
return type StatisticsGateway is not compatible with Statistics
C:\Documents and Settings\pagendg\.grails\2.3.8\projects\osrpms\plugins\cache-ehcache-1.0.1\src\java\grails\plugin\cache\ehcache\GrailsEhCacheManagerFactoryBean.java:656: error: cannot find symbol
return getUnderlyingEhcache(name).getSearchAttributes();
^
symbol: method getSearchAttributes()
location: interface Ehcache
C:\Documents and Settings\pagendg\.grails\2.3.8\projects\osrpms\plugins\cache-ehcache-1.0.1\src\java\grails\plugin\cache\ehcache\GrailsEhCacheManagerFactoryBean.java:653: error: method does not override or implement a method from a supertype
#Override
^
try to delete the project’s folder under the .grails directory, e.g. ‘~/.grails/2.3.8/projects/osrpms’.
and the commands
grails clean-all
grails clean
then run the project

grails heroku plugin - unable to resolve class grails.plugin.cloudsupport.AbstractCloudTagLib

When I run the
git push heroku master
command, I get the following error (below). Per one this thread, I uninstalled the heroku plugin, installed the cloud-support plugin, and re-installed the heroku plugin. That didn't change the error. I entered a JIRA on this at the plugin, but am posting here so that there is an easy reference to whatever solution the grails folks are able to provide or in case dialogue on the problem/solution is required.
Thanks
Error is:
[mkdir] Created dir: /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/tomcat-1.3.7
[unzip] Expanding: /app/tmp/repo.git/.cache/cache/org.grails.plugins/tomcat/zips/tomcat-1.3.7.zip into
/app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/tomcat-1.3.7
Installed plugin tomcat-1.3.7 to location /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/tomcat-
1.3.7. ...
Executing tomcat-1.3.7 plugin post-install script ...
Plugin tomcat-1.3.7 installed
Plugin provides the following new scripts:
------------------------------------------
grails tomcat
[mkdir] Created dir: /app/.grails/1.3.7/projects/build_36v61myh1movb/plugin-classes
[groovyc] Compiling 106 source files to /app/.grails/1.3.7/projects/build_36v61myh1movb/plugin-classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-1.0/grails-
app/taglib/grails/plugin/heroku/HerokuTagLib.groovy: 17: unable to resolve class grails.plugin.cloudsupport.AbstractCloudTagLib
[groovyc] # line 17, column 1.
[groovyc] import grails.plugin.cloudsupport.AbstractCloudTagLib
[groovyc] ^
[groovyc]
[groovyc] /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-1.0/grails-
app/taglib/grails/plugin/heroku/HerokuTagLib.groovy: 22: unable to resolve class grails.plugin.cloudsupport.Abstr
actCloudTagLib
[groovyc] # line 22, column 1.
[groovyc] class HerokuTagLib extends AbstractCloudTagLib {
[groovyc] ^
[groovyc]
[groovyc] /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-
1.0/src/groovy/grails/plugin/heroku/HerokuBeanPostprocessor.groovy: 17: unable to resolve class
grails.plugin.cloudsupport.A
bstractCloudBeanPostprocessor
[groovyc] # line 17, column 1.
[groovyc] import grails.plugin.cloudsupport.AbstractCloudBeanPostprocessor
[groovyc] ^
[groovyc]
[groovyc] /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-
1.0/src/groovy/grails/plugin/heroku/HerokuBeanPostprocessor.groovy: 27: unable to resolve class
grails.plugin.cloudsupport.A
bstractCloudBeanPostprocessor
[groovyc] # line 27, column 1.
[groovyc] class HerokuBeanPostprocessor extends AbstractCloudBeanPostprocessor {
[groovyc] ^
[groovyc]
[groovyc] /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-
1.0/src/groovy/grails/plugin/heroku/HerokuMongoBeanConfigurer.groovy: 17: unable to resolve class
grails.plugin.cloudsupport
.AbstractMongoBeanConfigurer
[groovyc] # line 17, column 1.
[groovyc] import grails.plugin.cloudsupport.AbstractMongoBeanConfigurer
[groovyc] ^
[groovyc]
[groovyc] /app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-
1.0/src/groovy/grails/plugin/heroku/HerokuMongoBeanConfigurer.groovy: 24: unable to resolve class
grails.plugin.cloudsupport
.AbstractMongoBeanConfigurer
[groovyc] # line 24, column 1.
[groovyc] class HerokuMongoBeanConfigurer extends AbstractMongoBeanConfigurer {
[groovyc] ^
[groovyc]
[groovyc] 6 errors
Error executing script Compile: : Compilation Failed
: Compilation Failed
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: : Compilation Failed
at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:920)
at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:607)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at Compile$_run_closure4_closure10.doCall(Compile:117)
at Compile$_run_closure4_closure10.doCall(Compile)
at Compile$_run_closure10.doCall(Compile:280)
at Compile$_run_closure10.call(Compile)
at Compile$_run_closure4.doCall(Compile:104)
at Compile$_run_closure3.doCall(Compile:69)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
... 10 more
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/app/.grails/1.3.7/projects/build_36v61myh1movb/plugins/heroku-1.0/grails-
app/taglib/grails/plugin/heroku/HerokuTagLib.groovy: 17: unable to resolve class
grails.plugin.cloudsupport.AbstractCloudTagLib
Problems before this, note git push gives me no opportunity to respond to the [y,n] prompts:
Plugin mail-1.0 installed
Resolving plugin JAR dependencies ...
Executing spring-security-ui-0.1.2 plugin post-install script ...
Plugin spring-security-ui-0.1.2 installed
Plugin provides the following new scripts:
------------------------------------------
grails s2ui-override
You currently already have a version of the plugin installed [mail-1.0]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
You currently already have a version of the plugin installed [mail-1.0]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
You currently already have a version of the plugin installed [mail-1.0]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
No valid response entered - giving up asking.
Plugin mail-1.0-SNAPSHOT install aborted ...
You currently already have a version of the plugin installed [spring-security-core-1.2.7.1]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
You currently already have a version of the plugin installed [spring-security-core-1.2.7.1]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
You currently already have a version of the plugin installed [spring-security-core-1.2.7.1]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
No valid response entered - giving up asking.
Plugin spring-security-core-1.2.1 install aborted ...
You currently already have a version of the plugin installed [jquery-1.7.1]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
You currently already have a version of the plugin installed [jquery-1.7.1]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
You currently already have a version of the plugin installed [jquery-1.7.1]. Do you want to upgrade this version? [y,n]
Invalid option 'null' - must be one of: [y,n]
No valid response entered - giving up asking.
Plugin jquery-1.6.1.1 install aborted ...
[mkdir] Created dir: /app/.grails/1.3.7/projects/build_28p9jo3vo48wb/plugin-classes
[groovyc] Compiling 106 source files to /app/.grails/1.3.7/projects/build_28p9jo3vo48wb/plugin-classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] /app/.grails/1.3.7/projects/build_28p9jo3vo48wb/plugins/heroku-1.0/grails-app/taglib/grails/plugin/heroku/HerokuTagLib.groovy: 17: unable to resolve class grails.plugin.cloudsupport.Abstr
actCloudTagLib
[groovyc] # line 17, column 1.
[groovyc] import grails.plugin.cloudsupport.AbstractCloudTagLib
[groovyc] ^
[groovyc]
I too had this problem with grails 1.3.7.
As suggested by Burt, adding the following to your BuildConfig.groovy will resolve the problem:
compile ':cloud-support:1.0.8'
I've followed the Basic Tutorial of Burt's here, after the above was added, my web-app compiled and deployed to Heroku successfully.
Installing the cloud-support plugin is the fix. Try running grails clean and grails compile to get it to resolve the dependencies.

Resources