Scaffolding a new Angular app with Yeoman and Bower causes Eclipse out of memory - eclipse

I've just started with Yoeman, Bower and Grunt, and on two separate projects I've used Yoeman and Bower to scaffold an Angular application.
Eclipse (STS 3.4.0) both times immediately huffed and puffed and ran out of memory.
This is strange to say the least, because Eclipse has a lot of memory available.
I thought at first that I might exclude that massive 'node_modules' folder from validation, but I've already excluded all javascript files from any validation.
Has anybody got any clue why Eclipse dies on me when I use Bower?

I finally solved this by excluding the top Grunt node-modules folder from javascript validation.
A bit odd, because I had already disabled javascript validation for the project.
In Eclipse open the Preferences for the project with the problem, then click on 'Validation' in the left-hand column.
Then on the right-hand side click on 'settings' for Client-side javascript.
Then you add an Exclude Group, adding a rule for the folder you want to exclude.
This finally solved my problem.
Actually it was not a definitive solution. When I opened a new node project I got the same problem and my solution above was not effective.
The best solution is the last answer here, which I used to exclude the node_modules folder:
How to exclude specific folders or files from validation in Eclipse?

Related

What causes "ghost" classes to appear in Tomcat/Eclipse after big changes?

I recently renamed one of the projects in my workspace. As a result Hibernate is throwing errors on a "ghost" class which no longer exists and is not referenced anywhere in my entire workspace including, source files, hidden files, config files, derived files, and binary files.
See screenshot below for visual people.
Where is the non-existing class name coming from? It is clearly being found by a component-scan.
Every time this happens, I am able to work-around the issue by doing all the following:
Delete the Tomcat server
Delete all my projects from Eclipse
Re-clone projects from git into Eclipse
Re-create new Tomcat server and re-add the projects into them
Is there a better solution?
You never mentioned whether you did a "Project->Clean..." from the menu. That could very well help. It's also not clear whether this is a Maven project. If it is, then doing Maven->UpdateProject from the project context menu could help.

Issues with Liferay 7.1 workspace imported from Github

I have cloned my Liferay 7.1 workspace from my Github repository. When I try to get Assistance in Liferay IDE using Control+Space, I get error:
This compilation unit is not on the build path of a java project
This happens on the new module project created in the same workspace(that was cloned from Github).
But when I create/import module from my local workspace that was created by Liferay for first time, this issue is not there.
I feel like there is some extra workspace setting that I am not doing in my Github workspace. Like we had to create build.username.properties in the SDK folder for Liferay 6.2. Totally stuck and no solutions anywhere.
I tried fixing Project Build path and Project Facets but did not help.
The way you did it in your own answer obviously solved it. My take on this is: The problem was most likely the .project file, because it contains all the configuration that eclipse requires, and the error message you post is an indicator that eclipse doesn't know what to do with these files.
The .project file can be regenerated from gradle settings, typically by choosing "gradle / refresh" (from memory, from the context menu of the project/workspace in Project Explorer), which will read the gradle settings and apply them to the eclipse world. This might happen automatically, but it might also need some manual push - next time you might want to try this, because just copying random files rarely is a good idea. You might end up pointing to other directories far outside of your workspace, and wonder why a local change is not picked up.
There were some differences between the workspace that I imported from Github and the one that Liferay was creating on my local. I opened both the workspaces in Beyond Compare. Following are the files that had major differences. I made them same and it started working after Gradle Refresh in Eclipse.
liferay-workspace/gradle/wrapper/gradle-wrapper.properties
liferay-workspace/.project
liferay-workspace/gradle.properties
liferay-workspace/gradlew
liferay-workspace/settings.gradle

Eclipse file search finds the same file multiple times

In Eclipse I have two maven projects A and B, where A is a parent for B. The directory structure is the following:
A/pom.xml
A/B/pom.xml
A/B/...
Then I use File search (Ctrl+H) to find any file in the project B. The search result window shows the file two times with different relative paths:
A/B/<my_file>
B/<my_file>
So, the same file is shown twice. Obviously, the first search result is reduntant. Is there a way to exclude these duplicate search results?
What I personally do to avoid this is marking each module in the parent project as derived (right-click on the folder > properties > Attributes: Derived).
Then when you perform a file search, uncheck "Consider derived resources" (I don't think it is checked by default) and you won't get the A/B/<my_file>.
The only inconvenience is that you must do this for each module, and each time a new module is added.
In an open resource window (cntrl+shift+R), click on the arrow on top-right and check "Filter Duplicated Resources". This worked for me.
Checking Window -> Preferences -> Maven -> Hide folders of physically nested modules (experimental) worked for me in Mars.1 Release (4.5.1).
After checking it I closed all projects within eclipse, deleted eclipse project files (.project, .classpath and .settings) and reimported my maven projects.
I had similar problem.
My solution for this problem was
Create eclipse "working set" of projects to search
Set this working set as option into search dialog
Search in it
Windows - Preferences - Maven - Hide folders of physically nested modules
I agree with Damon Horrell.
Go to Windows - Preferences - Maven - Hide folders of physically nested modules (make sure the checkbox is checked).
Note: Make sure to re-import the maven project into eclipse to see the changes.
Within the parent project, child ones were already visually hidden in my case, but still found through search and Ctrl-click links.
I solved this by using Resource filters:
Right-click (parent) project > Properties > Resource > Resource Filters
Click Add Filter..., select Applies to -> Folders and enter one child project's folder name, click OK
Repeat 2. for all child project folders
By the end, you should have something like this:
There is an ancient bug which requests Eclipse to support nested projects. Opened 2008, won't happen soon, I guess.
Since Eclipse doesn't support Maven's default nested module layout, you have to import each module individually which doesn't confuse Eclipse but it can confuse you as you can see in the search results. Similar things happen when you start to save launch configs in a module.
There are several possible solutions:
Get used to ignoring half the search results. Takes some discipline but no magic.
Make sure your root project doesn't contain anything important that you might want to open from Eclipse (i.e. move the parent POM to a new module which must be a child of the root project). Now you can close the root project.
Takes some discipline where to put things in your project and it's clumsy when you have to add new modules.
Use the flat multi-module approach. This is an extension to #2, it looks odd and there might be plugins that are offended by that. So if you use a lot of nonstandard plugins, you should check whether they like the new layout.
As a new joiner, still couldn't comment but I'd really like to add something to the best answer. It works! It not only removed the duplicate files for me (one from child module and one from parent module), it also removed the class files from parent module).
But it added the folder to my .gitignore which will cause problem for new files/directories added later. I just reverted the change to .gitignore and it still works in eclipse.
Find this answer to disable auto change of .gitignore
EGit and Eclipse modifies .gitignore file but it should not
You can solve this problem using a flat multi-module approach.
Caveats may apply if you're using the maven-release-plugin with a version control system other than Subversion.
In addition to "Hide folders of physically nested modules" mentioned, you could uncheck parent modules when importing Maven project:

eclipse stuck when building workspace

I am using eclipse 3.4.1 Java EE under Vista. It seems to like getting stuck when building my workspace. Canceling the build doesn't seem to do anything as well.
Why is this happening and how do I fix the problem?
I was able to fix this with the following:
First, exit Eclipse. Then temporarily move the following .projects folder to a safe location:
mv .metadata\.plugins\org.eclipse.core.resources\.projects projects
Start and exit Eclipse, then move the .projects folder back to where it was originally:
mv projects .metadata\.plugins\org.eclipse.core.resources\.projects
Use at your own risk, of course.
Some time it's very helpful to execute eclipse from command line with "-clean" parameter to enforce it produce clean up for workspace.
eclipse -clean did not work but following did
eclipse -clean -clearPersistedState
Eclipse often freezes for me at 44% if I'm debugging Android over USB.
When disconnecting the device, Eclipse starts.
The accepted answer allowed me to get Eclipse started again, but it seems that the projects lost their metadata. (E.g., all the Git/Gradle/Spring icons disappeared from the project names.) I have a lot of projects in there, and I didn't want to have to import them all over again.
So here's what worked for me under Kepler. YMMV but I wanted to record this just in case it helps somebody.
Step 1. Temporarily move the .projects file out of the way:
$ cd .metadata/.plugins/org.eclipse.core.resources
$ mv .projects .projects.bak
Step 2. Then start Eclipse. The metadata will be missing, but at least Eclipse starts without getting stuck.
Step 3. Close Eclipse.
Step 4. Revert the .projects.bak file to its original name:
$ mv .projects.bak .projects
Step 5. Restart Eclipse. It may build some stuff, but this time it should get through. (At least it did for me.)
Step1:
Open project directory and edit .project file, remove following lines to disable java script validation.
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
Save file.
Step 2:
Go to Eclipse installed directory and open eclipse.ini(or sts.in if you have STS), change xms and xmx value based on your RAM size of your computer.
-Xms512m
-Xmx1024m
-XX:MaxPermSize=256m
OR: in windows, go to eclipse shortcut in desktop, right click->properties-> add following:
C:\software\eclipse\sts-3.6.2.RELEASE\STS.exe -clean -Xms512m -Xmx1024m
Run Eclipse.
Go to Eclipse->windows->preference->Validation, enable Suspend all validators. Do this if you don't want do any validation listed in the list given in Validator panel.
I have this problem whe I have too much maven projects open at once. What I tend to do is:
Restart eclipse (sometimes I need to kill eclipse)
Disable automatic build immediatly (project > uncheck Build automatically)
Right click the project(s) I want to have rebuild
Close unrelated projects
Re-enable automatic build
This enables a functioning rebuild in 99% off the cases in my workspace.
You may want to take a look at How to report a deadlock. You may also want to check the Error view and/or the error log ([workspace]/.metadata/.log). If that doesn't help, you'll probably need to include more info about which plugins you have installed and which projects you have. Can you create a minimal workspace which reproduces the problem?
I faced Similar issue in Eclipse Indigo. I changed the HeapSize it started working correctly. I just added following eclipse.ini file
-vmargs
-Xms1024m
-Xmx1024m
It worked fine after increasing the VM size
The only solution for me (Luna 4.4.1) was this:
Go to Project Properties > Builders and then uncheck the Javascript Validator.
I had same issue with my Eclipse and as a solution, I created new project, copied all resources manually (using windows copy/paste) to new project, deleted old project and that's it.
Sometimes, this happens due to improper System shutdown and Eclipse workspace started facing similar issues.
Hope it will work.
Unselect automatic build using Eclipse-> Windows->Preferences helps fixing this issue.
Deleting some of the JDT indexes (in .metadata.plugins\org.eclipse.jdt.core), particularly the big files, often fix or ease the problem for me.
I just had the same problem.
By using Task Manager to kill the build process and exiting Eclipse with no projects open, I was able to get back into Eclipse and clean the project without opening it. I then restarted Eclipse again,loaded my project and all OK.
I've found that this might also happen if you rebuild a workspace with a project containing a lot of image data (such as a dedicated images project). Might be best to put something like that into its own workspace and handle it separately to the rest of the projects you deal with.
If you can't, then don't clean that project when you clean and rebuild. Only rebuild when necessary.
In my case problem arise after importing downloaded project - stuck at 80% build. Solved by adding write permissions for group to project's files (Ubuntu 12.04).
In my case it helped to remove the source folders from my favorites in the Windows Explorer (Windows 8.0). It seems that the build was not actually stuck, but triggered in some kind of infinite loop (as mentioned here - Bug 342931).
Sometimes the problem seems to be fixed by killing other programs which have files open from the project folder.
Looking at the logs in [workspace]/.metadata/.log provided useful information for me.
Turned out there was a java.lang.OutOfMemoryError: PermGen space error when the workspace build would hang.
This can be edited in the eclipse.ini or sts.ini(If you are using SpringSource Tool Suite) file.
I faced the same problem when I tried to install Angular.js with bower in my project. I seems bower has lots of javascript files it downloaded automatically which caused my IDE to stuck in validation process for a long time. So, I solved this problem this way,
I first installed tern.js 0.9.0.
Then I went to the project properties, selected tern script path
included only the path I needed for validation, My project's
javascript folder. I excluded other path like placeholders,
Angular.js files, Jquery files.
I selected the Javascript from the properties again and did the same
things in include path's source.
My IDE currently working without freezing. I took help from there. Tern
I guess it can be helpful, where any IDE stuck due to lots of Javascript file.
I tried lots of these suggestions, but the only thing that finally worked for me was creating a new workspace, and freshly checking out all my projects into that folder. Then it worked fine ;-)
I just restarted eclipse and it started working the next time.
Refresh all the projects u want to build.
Worked
Restart eclipse.
It worked for me several times.
I was able to solve this by removing extra folder that Eclipse had created in my eclipse installation folder. I didn't install and I was using Eclilpse Neon 3 with Spring Tool suite also installed. But, when I looked into extracted eclipse installation, I had C: folder which had some folder structure. It was mirror image of my Downloads folder. I removed it and restarted.
It worked for me!
None of the the answers here worked for me. What worked was to delete the following folder
C:\Users\your username\workspace\project
name.metadata.plugins\org.eclipse.core.resources.projects\project
name\.indexes
Rather than debug and find the exact root cause(s) for this, I just deleted the projects and the metadata folder. Eclipse will rebuild the .metadata file the next time it's launched.
I then pulled in the latest project code and the problem was solved. It was more work as I had to reconfigure everything, including my servers, but build workspace had been stopping at 50% for anywhere from 3 to 5 minutes before it would completely finish, so it was worth the effort.
Also, I've found that with Eclipse, if you stop the build workspace before it completes and shut down Eclipse if that hangs up everything, you can really mess up your configuration and waste lots of time trying to get it stable again. I'm using Eclipse Oxygen, but I've had this happen in all the versions of Eclipse I've used, so I really try to avoid it, if possible.
Inside the project folder open .project file. There is a bad entry and it might help
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
If you are using Maven as a build tool you might want to:
Close eclipse
Delete dependency directories located in .m2/repository/ - in
Linux
it's located under Home directory and in Windows it should be in c:\Users<YourUsername>.m2 (replace '' with your
username)
Start Eclipse and enjoy normal work :)
That helped me resolve this issue and I hope it helps you too. :)
Cheers!
P.S. I've edited my answer (as #howlger asked) where it was also suggested to delete .eclipse and .p2 folders as it can do harm (although it did NOT in my case + I had to reinstall some of plugins I'm using).
In case there is a problem on start when building your project disable the build automatically from menu. Project -> Build Automatically. This solved my problem while more sophisticated solutions could not.

Why is eclipse trying to compile files not in my build path?

I have a rather large project which contains a number of third-party dependencies which are linked via svn:externals. These include tomcat and blazeDS, which are packaged by our installer via ant. The problem is that these projects contain dozens of sample JSP pages, and eclipse chokes on them when trying to build the project, producing hundreds of errors.
Our project setup is something like this:
src/
main/
test/
third-party/
blazeDS/
tomcat/
etc.
Now, in eclipse, my project's build path is set to only include subfolders in src/main and src/test. Yet, for some reason, it still tries to build everything beneath third-party. I have clicked on third-party and selected "remove from build path", but this had no effect. I even tried adding the third-party folder to the build path, and then excluding "", "/*", and "**/*.jsp", but again, to no effect.
What is going on here?
Edit: Thanks for the suggestions, though unfortunately, they don't seem to fix the issue. I don't have the CheckStyle plugin installed (I'm using Eclipse 3.4.1 with the only custom plugins being subclipse and flex builder), and I tried disabling all extra builders except for Java, but the errors are still being thrown.
I usually have this kind of issue with CheckStyle plugin, where you need to specify in its properties (right-click on project -> Properties -> CheckStyle):
"Exclude from check Files non located in a source directory"
Otherwise it does analyze (and reports warning/errors on) files which are not candidate to be compiled in the first place.
Couple of other suggestions:
try restarting your eclipse with the -clean option (eclipse software version of 'did you reboot it ?' ;) ). Beware it can reset your workspace perspectives, so you may want to try that with a copy of your workspace instead.
try deleting your project (your workspace reference of your project, not its actual content), and reimporting it (beware of your custom launchers, they may get removed in the process).
check if you do not have any linked directory within src or test, which would point to thirdparty(/**): that would explain the unwanted compilation.
It could be that your eclipse project is configured to have extra Builders. You can check that in the project's properties (right-click on project -> Properties -> Builders).
In my case it was because there was a reference to the file (which I had excluded from the build path) in another file which was in the build path. I wanted to exclude SegModel.hpp from the build path, but in another file, I had specified template short K::KEstimate<SegModel>(SegModel& m, short stepCode);