Grails asset-pipeline Shows wrong Build Path in Eclipse - 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.

Related

Resolving variable in jsp page

I committed my eclipse project on GitHub and since then, every jsp is creating an issue.
I tried Git staging and everything is synced with GitHub.
Website is working fine too.
But I can't resolve the variable or any java object.
May be your project class-path missing the jar file Servlet-api.jar. Please check and add manually this jar into your classpath, then restart the server.
Solved:
Java Library Unbound problem
Went to Java Build Path in properties.
selected the conflicting JRE Library
Go To Edit-> Selected Workspace Default JRE.
Click OK.
Done.

Unable to deploy my spring web project to eclipse internal tomcat server.(java.lang.ClassNotFoundException on tomcat startup)

when I use an external tomcat everything is just fine. but I need to deploy my project on internal eclipse tomcat server in order to be able to use DCEVM class hot swapping.
When I try to start tomcat server from within eclipse it says it is not able to find one of my service classes I mentioned in my spring security configuration file as a bean.
I also tried to add the project to tomcat class path but it did not solve my problem.
UPDATE
I found out the problem is because when I deploy my web project to eclipse tomcat server, no .class is copied to:
C:\Users\Meysam\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\villapweb\WEB-INF\classes
in fact, this folder contains my src/java/main package structure but no .class is copied in it.
lib folder is fine though (e.g. all dependencies of maven and other stuff copies in the path it is supposed to)
I think there might be something wrong with m2e-wtp plugin. I dont know what!
I am using eclipse 4.3 BTW.
SOLVED
I Solved this issue following these steps:
right click on project in eclipse > properties > project facets
in the right panel select runtimes and select your target server. Apply and ok.
in the server modules list right click on project module and click clean module work directory
right click on the server itself and you can clean both server and tomcat work directory one after another
if that didn't work, try project > clean and also toggle "build automatically" option under project menu item.
Thats it. tomcat now copies all .class files to the target server and you see no ClassNotFound exception as tomcat starts up.
[Copied to answer section]
I Solved this issue following these steps:
right click on project in eclipse > properties > project facets
in the right panel select runtimes and select your target server. Apply
and ok.
in the server modules list
right click on project module and
click clean module work directory right click on the server itself
and you can clean both server and tomcat work directory one after
another
if that didn't work, try project > clean and also toggle
"build automatically" option under project
Thats it. tomcat now copies all .class files to the target server and you see no ClassNotFound exception as tomcat starts up.
I've followed the steps on the answer but It still wouldn't work for me, so, besides doing these steps once, I've found that doing a refresh on the target after doing a clean install automatically triggers the "Republish" status on the server, so when the server is executed all changes on the compiled classes (new classes and changes to existing ones) are then copied to wtpwebapps when the server is started.
I had almost the same problem - one of my projects did not make it to the deployment area (its jar). What i did is 1) remove the appliction from tomcat 2) clean tomcat work directory 3) most important: project - clean - all. Then i added the application again and... problem solved
I had the same problem in Web Dynamic project converted to Maven project.
I found error in properties->Deployment Assembly->right panel.
There was source=src folder and deploy path=WEB-INF/classes. Classes couldn't be found by Eclipse.
Changed to source=target/classes.

Another GWT module may need to be recompiled

I'll start with the other threads I've read:
GWT module may need to be (re)compiled REDUX
Some subtlety of GWT compilation - "gwt module may need to be (re)compiled."
Google App Engine - recompile GWT module
GWT Maven : Module 'xxx' may need to be (re)compiled
I have taken the following steps to fix this:
Cleared my browser cache.
Deleted gwt-unitCache folder.
Deleted *.nocache.js.
Deleted every file that was left over from a previous build. (I did this by looking at the date and time it was created.)
Run both maven clean and gwt:clean on my project.
Compile by right clicking on the project and going to Google > GWT Compile.
Run maven package.
Put the war in my JBoss EAP 6.1 (JBoss AS 7) folder.
Connect to it and still get the "GWT module may need to be recompiled" error.
What else could be causing this error to come up?
This has happened to me in the past when I imported a GWT project to a different computer. Seems you have already done some things I have tried. Before you start, right click on your project, hit Refresh, so you don't miss anything that's not in sync with the file system. There are multiple things it may be, so here's all the things I did to get it working:
Before the following steps also helps if you use the same version of GWT that was originally used to create your project. Also, make sure gwt-servlet.jar, gwt-servlet-deps.jar, validation-api-1.0.0.GA.jar, and validation-api-1.0.0.GA-sources.jar in your libs directory are the same as the ones from your GWT SDK directory (only if your app uses them).
Delete gwt-UnitCache
Open up the war directory.
Delete ALL compiled module folders.
Delete the war/WEB-INF/deploy folder.
Delete the war/WEB-INF/classes folder. It may be hidden in Eclipse, so you may have to do it via your file system.
Now, on the menus: click Project > Clean...
Make sure a build happens too. Either make "Build automatically" is selected, or use the option in the "Clean" dialog.
Do a GWT Compile. If you have more than one module, ONLY compile the main module. Any inherited modules will also be compiled.
I hope this helps. Ask if you need any clarifications.

eclipse not updating output folder after compile

I have a maven project on eclipse with jrebel plugin installed. Hot-deploy used to work perfectly last week but now only xhtml pages are hot-deploy. When a java class is changed it doesn't hot deploy.
What I noticed is when I changed a file and save eclipse will automatically build it. But the output folder file is not updated base on file stamp that's why jrebel doesn't pick it up. When I run maven-install it compiles everything and all the java classes are reloaded which is not efficient.
So the main problem is eclipse newly compiled classes don't go to output folder (project/target/classes), even though it's set in Build Path.
Any idea?
By default, the content of your local Maven repository is cached for a day. This can happen even for bad downloads (as I experienced). See https://stackoverflow.com/a/7421893/44089 for a short description of how to work around that.
After several minutes of testing, I found a warning on a jar file specifically guava being downloaded as dependency. I've delete in repo to be redownloaded and after that jrebel is working again.
So the problem is a corrupted jar that causes everything to be rebuild even if only a single file is changed. But the weird part is there's no corrupted file error.

Grails dependencies 'empty' in java build path STS

My coworker is attempting to install STS, groovy/grails onto his PC. He has imported a TFS project which grabbed the source fine. However he is getting lots of build errors that appear to be the result of the Grails Dependencies library being empty. He cleared .ivy2 cache and restarted STS which repopulated the .ivy2 cache. However, the dependencies are still empty under the build path (right click project, build path, libraries tab, expand Grails Dependencies).
He might be able to add them manually, but that doesn't seem like the appropriate solution and may cause issues down the line. Any ideas?
Select "Grails Tools -> Refresh dependencies" from the context menu of your project. Then the dependencies are added.
I had the same problem. It turned out that an undeclared class was causing the problem. One of the STS engineers responded that "if the command "grails compile" fails, then STS will not have the dependency data. This data is produced as a side effect of the compile command. So it doesn't get generated if the compile fails."
Basically, the entire Grails Dependency issue was a red herring. If you look at the Error Log (Window->View->Error Log or Window->View->Other: General->Error Log) check to see there is an undefined that is stopping the grails compile.