I currently have a Maven Java 11 project that builds fine. However, I use Eclipse's implementation of the language-server for editing the code within Emacs. This works fine, everything that I really need is available.
However, my question, is how can I disable the Eclipse LSP/compiler from attempting to auto-compile the project? It's not always an issue, but often the JDTLS seems to be recompile everything all the time to the point that when I run Maven, it has to recompile everything again. At best, this is a slowdown in the develop->test cycle. At worst, I have to clean build frequently.
Eclipse has an option in its GUI which "builds automatically". I am curious, is there a text file I can toggle this setting with?
According to the lsp-java documentation, the setting you are looking for is lsp-java-autobuild-enabled.
However, if there is a way to run the tests directly rather than via Maven, it would be faster since Maven does not support incremental compiling like JDT does (ideally, compiling should be done incrementally on save and not when running the application or a test).
I am maintaining a java program that is not mine. I used eclipse and I could build the program with Ant. I don't know very much about Ant. Everything was installed fine on my eclipse IDE and the build worked perfect till today. I didn't change anything, so I don't know why it doesn't work anymore.
When I look at the external Tools Configurations,I see that the targets are missing. I have the message "No targets could be determined for the build file". Previously I could select some targets. Does someone know how it come that the targets disappeared?
I fixed it by switching the eclipse workspace. I went to menu File->Switch Workspace->Other, and then I have selected the same workspace I was working with. Eclipse restarted and the error wasn't there anymore.
This helped for me:
remove the build file from Ant view and add it again.
I have recently had a problem with Eclipse. I am developing a java application. It suddenly freezes whenever I try to save a file. Indeed, it happens to some files in my project while it works fine with the others. I have checked the .log file in my workspace and there is no error message! I tried to disconnect my project from GIT, but the problem persisted. It drives me crazy. I have to restart Eclipse many times everyday.
Any solution would be greatly appreciated.
Such kind of issues should provide all related info: OS, Java, Eclipse version, list of plugins installed. Example of file saved. CPU, RAM size, memory setting for Eclipse.
Without knowing those details some recommendation would be to analyze and try to find the cause by comparing:
try on other PC,
with other Java version
other Eclipse version
the same Eclipse version without any additional plugins.
increase Eclipse memory settings
Check if it is build related by disabling automatic build.
Check if there are "Save Action" configured in Preferences.
and so on.
maybe some plugin causes that, but usually people just go with new Eclipse instance instead of comparing different plugins combinations.
See also How can you speed up Eclipse?
Eventually, it's worked. I created a new workspace and import it my project to it. Everything works well since then, like a magic! It seems the problem occurred because my workspace was too old. I have been working on the same workspace since more than 2 years.
Thanks fellows for your time to help.
Today I came to work, happy. But when I opened my Eclipse, I saw that one of my projects has errors.It's weird because it shows that it has errors only in the window bar, and not in the Navigator. I don't have any Java errors, this is a valid project that was fine all the time:
Some of the errors on the error log of Eclipse:
JavaBuilder handling ImageBuilderInternalException while building: SP_Procedure
Cannot connect to VM
File <SomeFile> has been skipped, problem while reading ('Resource is out of sync with the file system')
Unhandled event loop exception
Internal error
When I run an application from this project, I get a warning message but when I proceed, it works fine, but still. It's very disturbing and I'm not sure if it's harmless.
I tried to:
Restart Eclipse
Restart my machine
Clean projects and recompiling them.
Refresh projects
Pray
Nothing helped. What could be the problem? (I'm using Indigo Service Release 2)
The following nuclear option has desperation written all over it. But I have been where the OP has been with the Juno version of Eclipse.
Run a "Synchronize with Repository" and save all of your local updates to a different directory.
Delete the project. (Check the box to delete the contents on disk. Scary step, but that's OK, because you saved it in a different directory in the previous step, right?)
Read in a fresh project from the repository. It builds happily at this point.
Integrate your local updates.
Keep on praying.
Looks that one unused JAR was deleted, but for some reason, I didn't get errors in any file, even in the files that imports this JAR! So what I did was restoring this JAR, delete unused imports and deleted the JAR again.
I've found this error after two days of navigating on this project on each file.. This is weird that Eclipse didn't recognize that1 this is an error, and throw many unrelated errors such as:
Cannot connect to VM
File has been skipped, problem while reading ('Resource is out of sync with the file system')
Unhandled event loop exception
Is this a bug in Eclipse? (All errors and warnings are enabled!)
1 As seen in the image in the question..
A class from the list of imports for the file seems to have moved out or the jar file containing the class is missing.
Expand the imports section and check if you find some classes that are missing but have been imported.
Though it is a pain, sometimes the easiest solution is to back up all your projects (either in a repository or somewhere else on your computer) then uninstall and reinstall eclipse. No it's not fun, but it should reset eclipse so everything works again. The downfall though is that you have to reconfigure eclipse to any special settings you had/reinatall any extra functionality currently installed (eg. android add-on) and reconnect to any repositories you have. While punting isn't fun, it can be effective... I hope you don't have to resort to this though.
I have went through that problem a lot of times, and tried everything you tried. Rebuild, recompile, refresh, remove and add JDK, remove and reinstall Eclipse... nothing worked
The only thing I concluded is that the workspace metadata was corrupted.
What I did (every time it happened) was
Create an empty workspace
Import -> existing projects into worskpace
Mark the "copy projects" (else it will only link them)
Wait for the copy, and start working with the new workspace
If you work with SCM systems (Git, SVN, etc), making a full checkout will do the trick too, but the worskpace import will let you retrieve those changes you didn't get to commit (if any).
It's a little painful if you have somethings already set (like JDK names, servers, etc), but then I realized it was faster than keep searching how to fix the workspace
Regards!
PS : I've been working with Kepler lately, and everything works fine till now
Click Window -> Show View -> Other -> General -> Problems
This view will show you what is wrong.
Did you, by any chance, update your virtual machine outside of Eclipse? I can't help but feel that we're both missing a finer detail here. I just keep seeing "cannot connect to VM" and thinking that it's a major clue.
Have you tried running anything from the terminal? Does it work there?
If so, do you know where your current edition of Java is located? Is Eclipse looking somewhere else?
Is this exclusive to one project? Do you use any additional libraries to the JDK?
Maybe try this for Resource is out of sync with the file system error:
Right click project in Eclipse Package Explorer
Close Project.
Right click project in Eclipse Package Explorer
Open Project.
Other things not mentioned:
project properties > java build path, see if any of those tabs got changed, local file got moved? read/write permissions on some file you are linking to?
project properties > java compiler, see if workplace settings have changed? maybe under errors/warnings, you can systematically set them to 'ignore' until the error goes away to determine what type of error it is?
maybe update some of the eclipse plugins?
I saw something like this happening for a number of reasons. Mainly because of validation in files other Java source code. See if you are validating XML for instance.
Right click your project and chose Properties (Alt+Enter) and Validation to see the related configuration.
As for the danger, I lived with those marks for ages and nothing wrong ever happened.
I have little experience in Java/Groovy/Grails, about 1 year using Eclipse and some weeks using GGTS, and I always got my projects with build path problems, or other related problems, with apparently no reason. The environment seems to be buggy. Any tip?
Below there's an screenshot of a project I was working on and, after a computer restart, a lot of wild build path problems had appeared.
PS.: To solve these problems I closed the project in GGTS, used a grails clean in console, opened the project again (all the problems still were there), then I just gave a look into properties > Java Build Path and all problems have gone. These steps makes no sense for me.
Like others I would not recommend Eclipse. All variants(sts,ggts,vanilla eclipse+plugins) are unstable at least on Juno, IMHO.
I personally use emacs, but like #James, I would suggest IntelliJ:
stable as in no strange internal errors pop up while doing Grails coding, no project corruptions.
better completion, especially dynamic methods