Today I see a strange behaviour of Eclipse 3.5.2 for the first time in 3 months.
First, when I run a main function, it runs a previously compiled version. Let's say I press Ctrl+F11 in the window with an open java class and existing main function. Usually it rebuilds the class and runs a new version. Today even if there was a compile mistake, it would run fine. So I guess it does not recompile the class.
Next, more strangely, if I intentionally make a mistake in the code and Eclipse underlines those lines in red, still the project Explorer does not mark them as containing errors. They remain of grey color if there were not any errors.
First I did not know how to solve this problem. I tried to reopen the project, restart Eclipse and finally reboot the OS. After the tenth attempt, after rebooting, Eclipse said that all project's files are "OUT OF SYNC with the file system". When I pressed "Refresh" - F5 on a project's header name in Project Explorer it finally marked all the files with errors as containing errors and running the main function gave the desired result.
An hour of my work passed and this happened again , with the other project. All the same. No marking of files as red, running no matter what old version of class with no compile errors.
And since Eclipse does not tell that files are out of sync, simply pressing F5 on a project cannot help.
What can you suggest?
When you select a project in the Project Explorer view and press F5, Eclipse should traverse the entire directory tree for the project checking that all files and directories all in sync. It does for me ...
The only thing I can think of that would cause this not to work is if you have file system timestamp anomalies. For example, if a file in the file system is updated but the file's last-modified shows that it was updated in the past. This kind of thing can happen if your machine's system clock is moved backwards or forwards at an inconvenient time. If you think this might have happened, try closing all projects, restarting Eclipse and doing another F5 refresh.
(I used to run into Eclipse synchronization issues a lot, but I put that down to a combination of flakey plugins and doing builds from the command line. Either F5 or Project>Clean usually works for me.)
It is also worth checking that you haven't turned off "Build automatically"; see https://stackoverflow.com/a/2818290/139985. This is not a "refresh" problem, but it would be easy to confuse it with one.
Is Build automatically on? (Menu > Project > Build automatically)
It happened to me because there was a cyclic dependency between two projects. Each project had the other on its build path.
Solution: Reimport the project
It happened to me when checking out a new file from svn in explorer. Eclipse could not find the new file for some reason.
I tried refreshing the project(F5) and Project > Clean and build the project(Project > Build All) none of these worked for me.
So I deleted the project from the Project Explorer view(Not from hard disk). Make sure you unselect "Delete project contents on disk(cannot be undone)" checkbox and save any unsaved changes before you do this.
Now reimport the project using File > Import option. That should work in most cases.
If you use gradle, or something similar, instead of reimporting a project you can just regenerate the project files (gradle eclipse for example), and then you can refresh the project. Less cumbersome than deleting and reimporting.
Related
IntelliJ (Ultimate 2018.1) is not building my project properly. The project is using Maven which doesn't seem to have any problems (all libs are there). The problem is as follows:
Everytime I start up IntelliJ, I am able to build all changes exactly one time. I can change contents of my files and those changes will be contained in the build. But every change I do after that first build is ignored by the build tool. So, every time I build the project (ctrl+f9) after that, I get "All files are up-to-date" and nothing is compiled. (If I am running the app on the application server and try a hot swap, the build says "loaded classes are up to date ...")
Only a restart of the IDE lets me rebuild the project.
Edit: As I just found out, a restart of the IDE is not the only possibility to make a build possible again. In the state of not being able to compile, I changed a setting in the compiler settings. After that, I was able to build again. But only once. I then changed the setting back and well, I could build again. Looks like something odd in the IDE. /Edit
Edit2: Oddly enough, the explicit compiling of the class (ctrl+shift+f9) is working. So the problem circles around the compiling of the whole project. While this is making IntelliJ usable again, it's error prone regarding multiple changed files... /Edit2
A few notes and configurations of the project:
The build produces a .war
It is deployed on a wildfly (which is not started once in this cycle, so this shouldn't be the root of the problem)
The exact same project was formerly developed in Eclipse where building and Hot-Swap worked flawlessly (and still do when I try Eclipse again)
Maven Config:
Compiler config:
Check with Intellij version. As I am using 1.4 community edition and for me its running proper.
Even I have updated few dependencies after building First Time and it get's rebuild automatically.
So for my understanding what you can do it just check with the Intellij update or change the default directory and rebuild it.
The problem with the "Build Project" command is the source discovery of IntelliJ. A long time ago, we made the choice to place our sources inside a folder named ".git" (not the folder in the repository), so IntelliJ had problems to discover the code inside that directory. The reason for that was an old approach of Eclipse to clone repositories into a .git folder. The directory looked like this:
C:\dev\.git\workspace and inside that folder was another .git folder (from the repository).
So, the answer is:
Don't put your git repository in a folder named ".git" or IntelliJ will not compile it (unless you only compile class wise).
I had a windows crash with blue screen as often happens. in this time my Intellij-Idea Data is gone and reset to default value and also my project data. so Intellij-Idea do not recognize my project as Spring-boot and I can not Run it.
I reimporetd the project, it is not working. clean, clear cache, Invadidate and restart and result was same. I check the project structure and see every dependency in module is gone although all dependency is still in my pom.xml ! so how I can fix it?
One thing you can try is to click the Reimport all maven projects button in the maven projects view , the circled arrows.
As a last possibility you can try - after closing IntelliJ - to delete from your project directory the *.iml file defining the IntelliJ project and the .idea folder. As this folder name starts with a dot, it's a hidden directory in some OS, so the best thing is to do this from a shell.
After that start IntelliJ and do a File/Open... and select the pom (or the directory containing the pom) to recreate the project.
Hope that helps.
I finally solve this problem by re Installing JDK. I find out that JDK is damaged by Windows blue screen cause the Intellij Idea even do not recognize Java classes of project like String.
after install last version of JDK every things worked fine.
I was working on a project in Eclipse that has several classes and one Interface. I decided to export it as a jar so that I can run it on another machine.
This went just fine. However, when I went back to Eclipse, it suddenly removed all of my file one by one as soon as I tried to edit one of them. Now there is only one file left and it's not even my main. I had everything in the default workspace directory and now only that one file remains.
Can I undo it?
Something similar just happened to me a while ago, Eclipse has the option to recover files no matter if you have a version control or not...
make right click in the project and make a "Restore from local history"
a new window with all accidentally removed files will appear and you can undo the mess :)
I'm using Eclipse Mars 4.5.0 IDE, and developing ColdFusion applications using CFEclipse plugin. Also, I have SVN Subversion and FileSync plugins.
The company, which I work, has a huge repository. I synchronized all files to the my own workspace and when I do any changes in Eclipse it should update my own workspace and development folder in our server.
It works fine, but sometimes, let's say once a week it starts to build workspace automatically. As I said workspace is huge, so it takes forever.
I cannot do any changes while it was building. Actually I can change the codes but I cannot save the file, saving task is just waiting to build workspace. When I cancel the building task, then try to save the code, before saving building workspace start again.
It's really annoying. I cannot do any work, I have to leave my computer at the work, when I came next morning building is done, and I can start to work. I tried everything to get ride of it, none of them worked.
Also project build automatically is unchecked. But when I do chances in the code, I have to build project not the workspace to sync the code to the development. But of course it builds all workspace not just project.
Interesting thing is that it is not happening all the time. Sometime it works fine, sometime not. For example, yesterday, I just copied one folder from one project to another one, and tried to build project, but Eclipse build whole workspace. I don't know what to do?
EDIT: Screenshot is added.
Have you tried unchecking build automatically in
Window/preferences/general/workspace?
EDIT:
similar question has been asked before on SO.
The answer was (as far as I can understand) to make jar-s out of projects that you use but don't want to compile them every time.
Make sure you have unchecked the option Build Automatically under the Project menu.
I've been spending the past day trying to fix a corrupted eclipse workspace. I have it synched on dropbox and it's been working fine for a long time but recently there was a problem with some conflicting files in the .metadata folder and it messed up everything, my projects just stopped showing in my project explorer.
I ended up re-importing the projects into the workspace and they show fine in project view, but when I try to place them in working sets each project appears twice. If I delete one of the duplicates, the other one gets deleted as well. Anyone know how to resolve this issue? I'd rather not delete .metadata since that would erase all my settings and preferences.
If I were you, I'd start a fresh workspace. Use the preference export/import capabilities to ensure you retain all your favourite settings between workspaces.
I have never managed to save a corrupted workspace. Sometimes you've got to just let them go, like a rabid dog.
Check whether or not they are the same files shown twice. If this is the case then the solution is simple - go to 'Project Explorer' window, expand downward arrow to get the menu, then 'Project Presentation' -> 'Hierarchical'.