Grails Project Not Auto Reloading - grails

I have a larger Grails project for which I have taken over development. I have used Grails before and one of the features that I found really nice-to-have is the auto-compilation/reloading when developing.
I haven't had to do anything special to make this work in the past, however for some reason it is not triggered for this project.
I do a simple "grails run-app" and modify a file when server is started - nothing! Any suggestions?
Windows 7, Grails 2.0.1, Java 1.6u35
IDE: Groovy Grails Tool Suite 3.1.0.M1 - Based on Eclipse Juno 4.2

Grails command line doesn't seem to properly handle spaces in directory names of GRAILS_HOME or HOME directory.
see:
http://jira.grails.org/browse/GRAILS-7936
it has links to various other related issues.
This comment has a workaround: http://jira.grails.org/browse/GRAILS-7936?focusedCommentId=72170&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-72170 .

Are you using eventCompileStart in scripts/_Events.groovy? That was my problem, see GRAILS-8776 (please comment and vote on that issue if this is your problem so we can get it resolved!).
Commenting out that block cause auto-reloading to start working again for me.

My solution:
Right click on project -> Properties -> Project Facets -> check Java and set it's correct version -> OK
Bingo!

Related

Grails 3 Taglib: cannot resolve symbol in IntelliJ IDEA

I'm using Grails 3.1.7 with IntelliJ IDEA Ultimate 2016.1. In the project are several custom taglibs. The tags are working as expected, but the view editor shows an error on every tag usage:
Is there a way to configure IntelliJ and/or Grails that this is correctly shown? The build in Grails tags are shown correctly and jump to source is also working.
Edit 1:
On some tag there is a message that the that is not allowed here, but jump to source is also not working
In the gradle window, click "Refresh all Gradle Projects" - This usually helps resolve anything that's not found.
Also check out 2016.2 EAP as there are Grails 3 and GORM 5 improvements.

Debug grails recompilation

I am working on grails 2.0.4 project and at some point I've found that recompilation process does not work. Further tries showed that first run-app after removing ~/.grails/2.0.4 has recompiling process working well, but running run-app next time ignores changes in files during run (no changes on pages and no Compiling… message in log after appears). So my question is how to debug recompilation process?
There's some JIRA issues related to the recompilation:
http://jira.grails.org/browse/GRAILS-8951
http://jira.grails.org/browse/GRAILS-8573
http://jira.grails.org/browse/GRAILS-8914
Only the third one is fixed. Looking in the first, some folks said that this not work:
grails run-app
But entering in the interactive mode works:
grails
run-app
Looking a bit in the code, I can see that GrailsProjectWatcher.java is responsible for file changes. Try to add debug to the related package and see if you get messages.
If it's one particular class that's not reloading, one thing you can check is that the package definition is correct. Grails will happily compile a class that is in the wrong package, but this breaks the reloading mechanism.

Changing Grails SDK in IntelliJ IDEA Doesn't Work on Plugin Modules

IDEA 11.1.2
I have a Grails app I need to upgrade. The application consists of several modules. One being the application and a few others being plugins. I right clicked on the application and went to Grails -> Change SDK Version. I chose the version I wanted, then IDEA asked me if I wanted to upgrade the application. Clicked yes and all was good.
I've been trying to do the same thing on the plugin modules. IDEA never asks if I want to upgrade and it doesn't appear to change the SDK. If I upgrade the modules from the command line, when I come back to IDEA, it thinks there is a version mismatch and automatically downgrades me without even asking.
Is there a workaround for this?
It worked for me in this IDEA version. Make sure that you change Grails version in application.properties of all plugins:
app.grails.version=2.1.0
Then right-click on every module (plugin), Grails, Change SDK version. It should be changed already.
Have exactly same problem - app + plugins wich requires different SDK (for testing).
After some investigation found that it's an IntelliJ IDEA bug IDEA-114418. So, I think, it will be good if you'll vote for this bug there too.
I also had the same bug. I took extreme measures to rectify it.
I deleted the old grails from the Global Libraries. Go to file>Project Structure > Global Libraries . It should complain that this is used by a module.
Then I had to add grails framework support, but added the new one.

Error in BlackBerry_App_Descriptor.xml

I've installed Blackberry Java plugin 1.3.0.
When I create a new project BlackBerry_App_Descriptor.xml shows error.
What is the problem? Is there any environment path problem? If yes, what should to set path?
InvalidRegex: Pattern value '([a-zA-Z_]{1,63}[\s-a-zA-Z_0-9.]{0,63}[;]?)*' is not a valid regular expression
you should of course follow the hint in the error and check that none of your values in your BlackBerry_App_Descriptor.xml will fail the regex.
However, there is a very strange case whereby you will see this error regardless of your values. In fact, creating a new project straight from Eclipse will still show the error.
Turns out this could be caused by having Java JRE 7 installed on your machine. The BlackBerry plugin doesn't support this yet, Eclipse might be trying to use that.
The fix? You simply have to edit the eclipse.ini that will live in the same directory as your eclipse.exe that you use to start the IDE. Closing Eclipse and making a backup of eclipse.ini before you do this would be a good idea.
Find the line "openFile" and immediately after, add the following:
-vm
C:/Program Files/Java/jre6/bin/javaw.exe [or wherever your jre6 directory might be]
Cross your fingers and restart Eclipse.
Rebuild your projects.

Getting an error message while building PhoneGapSample in blackberry Webworks

I am working on PhoneGap BlackberryWebWorks i have install BlackBerry WebWorks plug-in:2.5.1 and Blackberry WebWorks SDK:2.0.0. and PhoneGap 0.9.4.but while building the project in eclipse i am getting the following error
Errors occurred during the build.
Errors running builder 'Faceted Project Validation Builder' on project 'PhoneGapSample'.
Could not initialize class org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants
I am not getting any idea how to proceed ahead to remove this error.If any one have any idea about this. it will help me to overcome from this error.
Thanks,
Sagar.
Per neo's comment, install Eclipse Java EE Developer Tools using the Eclipse -> Help -> Install new software -> Work with -> (your Eclipse version's download repository. e.g.:) Indigo.
In the filter field type, then checkbox, Eclipse Java EE Developer Tools.
Download, install, boom: no more errors. Well, not that error, anyway, YMMV.
Edit: Mayoayres added a comment below that may apply if you still get this error despite following these instructions. If you find it helpful, upvote his comment!
Right click on your project >>> Properties >>> Project Facets >>> uncheck Static web Module
Hope to help.
Regards,
In eclipse juno there is some cases the project facets doesn't display any contents...it will give a error named "invalid values for project facets"...So there is a need to do the following
project >>> Properties >>> Builders
and uncheck the faceted project validation builder....
The accepted answer didn't work for me, but I found a solution: you need to install into the Eclipse plugins/ directory the .jar for org.eclipse.jst.j2ee.ejb, because it seems like you need it, but Eclipse WST doesn't properly depend on it, so it is not always installed when it should be.
The issue is completely unrelated to PhoneGap or Blackberry development, by the way.
As a more generic answer, this is because you either imported a project which is dependent on uninstalled Eclipse plugins. I had this issue when migrating to Eclipse Juno. The easiest solution, just edit your .project file in a text editor and remove the conflicting elements. Usually, this is in the buildspec or nature section.
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Keep a backup of your project file if you're not sure. You may always delete and recreate your project later on. It's easier to remove those references than to find and install the exact missing plugin versions.
In my case I was using Thymeleaf Eclipse plugin for thymeleaf content assist in my project and got these message in Eclipse Juno,
Errors running builder 'Thymeleaf Validation Builder' on project 'site'
Solution:
Select project
Project -> Properties -> Builders
Uncheck the Thymeleaf Validation Builder
Uncheck the builder corresponding to your error message and hopefully your problem gets resolved.

Resources