Why do my upgraded Grails projects have red exclamation marks? - eclipse

I've upgraded my Grails and on every project ( already created or new ) I have red exclamation mark. Projects are working fine.
I tried to fix it with Groovy-->Fix Compiler Mismatch Problem, with refresh dependence and Project-->Clean but without avail.
I thought that it could be problem with build path but I don't know how to fix it, so if anyone could help...

I have seen this loads of times doing this sort of stuff, the first thing to do is do a grails command wizard and clean
or grails clean
The try doing a
grails refresh dependencies
If you have actually upgraded grails over all and just copied your application folder into the new ggts (grails install) then a few things you need to do:
Create a new project under your new grails/ggts - take a look at applications.properties:
edit current applications.properties :
app.grails.version=2.3.7
Ensure the application version matches what you have in your newly created app under upgrade..
Then open grails-app/conf/BuildConfig.groovy for the new project under new upgrade and check closely the configuration. Infact copy entire BuildConfig.groovy over to your existing project and add any additional plugins you have in your project to the new BuildConfig.groovy
Then retry grails clean grails refresh depenedencies
This should fix issues.

Its most probably due to missing link to grails plugin. You can always delete those red exclamation marks by opening "Problem" view (GGTS -> Windows > Show View -> Others -> General -> Problems) and delete all errors if don't want to see them.
This is doable if you are not running your grails server from GGTS.
-SA

Related

Rename JEE project

I'm working on a JavaEE project, I already have the skeleton of an old project. All i have done is rename the project, packages and change the name in the project file (.project). But now when i'm trying to run, it returns error in the browser "The requested resource is not available". I've checked the web.xml and added a new jsp in vain it doesn't work. In the browser's address, it gives me the old name of the project(http://localhost:8061/smsgate/). I've tried a lot to fix the problem. what can i do? Is there any other file that i have to update and write in the new name? Please give me your ideas (knowing that i have to use that old project)
Do Project -> Clean in your workspace by selecting your current project. Also if using maven then right click your project and do maven -> clean.
Manually go to your target directory of your ear module and shift-delete everything inside your target and then rebuild your project to form new ear.
if you have configured the web.xml properly then strike your app url. Also ctrl+shift+delete your browser history and then check.
Why not create a new project using a maven archetype, just type in the console:
mvn archetype:generate
It will show you a list of available archetypes from the web, just choose one of them, for JEE6/JEE7 you could choose among:
1019: remote -> org.codehaus.mojo.archetypes:webapp-javaee6 (Archetype for a web application using Java EE 6.)
1020: remote -> org.codehaus.mojo.archetypes:webapp-javaee7 (Archetype for a web application using Java EE 7.)
If you agree with me, just type:
1019 or 1020 according to your needs and answer the questions like:
projectId:your-project-name
groupdId:com.yourdomain.reverse
version:1.0

Grails asset-pipeline Shows wrong Build Path in Eclipse

My problem is resolved but I don't understand why it wasn't working.
Using: Grails 2.4.2, Groovy 2.3.7, Java 1.7, Eclipse- Indigo
I set my project up, and in the assets folder under grails-app I placed my static assets. I was also using twitter-bootstrap. The project would run, but nothing would be displayed from the assets folder. I did a Grails clean and got build path errors. in Eclipse right clicking the project name and going to Java Build Path and under the source tab there were links such as:
projectName/.link_to_grails_plugins/cache-1.1.7/src/java
or
projectName/.link_to_grails_plugin/asset-pipeline-1.8.11/grails-app/controllers etc
I deleted my target directory, and deleted all the links that were errors inside the Source tab. I restarted eclipse and refreshed, and voila it worked. The links came back, looked exactly the same but were now good apparently. I'm just not 100% sure why it worked though. The assets were in the right place, and never moved. Why did this work?
Eclipse doesn't parse BuildConfig.groovy or infer paths or dependencies - it gets all of that from Grails. You can force it to reconfigure the classpath by right-clicking on the project node in the tree on the left and selecting Grails Tools | Refresh Dependencies. That will cause Eclipse to run grails compile --non-interactive --refresh-dependencies and it gets classpath information from that.
When you restarted it must have determined that enough had been deleted that it needed to refresh itself, or it might just do that each time you restart.

Issue making a Liferay Hook with Eclipse Liferay IDE - getting only empty project

I am using Eclipse Liferay IDE for making a hook to a Liferay native portlet. I mean a porlet that comes with default installation, eg. blogs, content management or similar.
I have done the steps like following:
Select new Liferay Project
Enter project name MyHook
Made configurations (found an SDK directory and Liferay Server instance for Runtime)
Selected Plugin type to Hook
My only option after that was Finish and I ended up having a project with certain structure without any class or properties file inside.
My problem is that I could only get an empty project and don't know how to make the modifications to the files of Liferay because no Liferay originated package names can be found if I make a new class file and try to start typing com.Liferay. or org.Liferay. Because this is a Liferay Hook project, I suppose some Liferay originating tips should normally pop up for my selection, but I didn't see any.
What I am making wrong? What I am missing? Should I know the filenames by myself or is there a trick somewhere to tell the IDE to give me some help?
I use Liferay 6.0 and my IDE version is 6.0.5. At least in my eyes they should match together.
In the IDE you first create a "Liferay Hook Project". This is indeed an empty project. Then you create a Hook, select the Hook project to create it in. You can do the second step manually, but there's a wizard helping you to do this. This might be what you've been missing
I made the same steps again and it worked! Somehow at first time I managed to do a Java project although the project should be interpreted as a Liferay project.
Maybe the IDE is not 100% working always. Whoever knows.

Groovy/Grails - Unable to Resolve Class

I am trying to build a Grails project in STS and am getting many error messages of the form: Groovy:unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder as well as others like Groovy:unable to resolve class org.grails.plugins.springsecurity.service.AuthenticateService
. I have Grails 1.3.7 selected in the Project Properties, but I don't see an item for 'Grails Depedencies' like I do when I create a sample project. Is this the problem? How can I add it back in?
I don't know why, but here are the steps I took to solve the problem:
Right click on the project and go to Grails Tools -> Enable Dependency Management
Grails Tools -> Refresh Dependencies. This correctly added the 'Grails Dependencies' library.
I still had plugin errors. I for some reason had to uninstall them and then reinstall them for the project to realize they were there.
For anyone who is using Grails >= 2.4
If you are using Grails 2.4 and above, use grails.util.Holders instead of org.codehaus.groovy.grails.commons.ConfigurationHolder.
Read the doc here section 'Static Holder'
Classes The following deprecated classes have been
removed from Grails 2.4.x:
org.codehaus.groovy.grails.commons.ApplicationHolder
org.codehaus.groovy.grails.commons.ConfigurationHolder
org.codehaus.groovy.grails.plugins.PluginManagerHolder
org.codehaus.groovy.grails.web.context.ServletContextHolder
org.codehaus.groovy.grails.compiler.support.GrailsResourceLoaderHolder
If you or any plugins you have installed are using these classes you
will get a compilation error. The problem can be rectified by updating
to new plugins and using grails.util.Holders instead.
If "Refresh Dependencies" has done all it can for you (as you indicate in your comment on the question), try disabling and re-enabling dependencies. You might try refreshing dependencies again afterward if the Acegi plugin still isn't recognized.
there is another way solved me this issue when i moved my workspace from Windows OS to Ubuntu , go to
yourWorkSpace -->yourGrailsProject-->setting folder --> org.grails.ide.eclipse.core.prefs,
then check all the grails paths are correct or not , because in my case all were pointing to windows paths ..
Hope this solve.
I faced a similar issue: "Unable to resolve class GrailsTestCase". I checked Grails Tools of my project and observed Dependency Management was already enabled (IDE - GGTS). I just disabled Dependency Management, refreshed and enabled it again. This solved the issue for me.

Eclipse RCP: How to troubleshoot plugin dependencies & classpath problems?

I am working on an RCP project based on eclipse. It has been working fine but recently I thought I'd upgrade it to use a new eclipse version (3.2 -> 3.5).
After a bit of trouble, it was running on the new platform. Then I did something. Don't know what. The end result is that I'm now getting a classpath error when one of my plugins (A) tries to access a class in one of the dependent plugins (B) (also one of mine).
As far as I can see, Plugin A has Plugin B in its' dependency list and the compiler shows no errors. To test, I created a new Plugin C with one class and accessed the class from Plugin A. That works fine.
Does anyone have any hints for troubleshooting such issues? A checklist of settings to check? I've been struggling with this for hours and getting nowhere! Particularly frustrating as it was working until I changed something!
Thanks
Update
I should also say that the project is quite old and uses the plugin.xml and not the manifest. Could this be a problem? Is there a way to upgrade?
Some ideas:
Clean-and-build every project (maybe after a restart of Eclipse)
Check, whether the required packages are also exported
Check the Error log, maybe there is some unloadable plug-in, etc.
Check the Run configuration, whether every required plug-in is present there
If the problem does not happen in a Runtime workbench, but in an Exported RCP app, then check whether you compile the project with the same settings during export than in Eclipse
I hope, something helps about these.
You can try the following in your run configuration:
In the Main tab check Clear (workspace) under Workspace Data
In the Configuration tab check clear the configuration area before launching under Configuration Area
This helps me every time I encounter some strange ClassNotFound errors.
If I understand you correctly you have no compiler errors but when you run you get class not found exceptions? You could try PDE Tools > Update Classpath from the project's context menu to see if you declared any dependencies outside of the MANIFEST.MF file, which would result in compiling code that fails at runtime.
I developed for RCP quite a long ago, but if I'm not wrong, since 3.4 or 3.5 you have to declare in the plugin configration which packages/classes are exported for dependent plugins and which are not.
This is unlike the old convention of using 'internal' in the package to mark non-exported packages.
Since you have plugin.xml from very old version of eclipse, it might be the problem, as exported resources from one plugin to another were not enforced in Eclipse RCP 3.2.
One more complement, hope it helps.
Open plugin.xml, check "build" tab, see how "binary build" are configured. It affects which files will compiled and exported.
See binary build here : http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Feditors%2Fmanifest_editor%2Fbuild.htm