Intellij autobuild - non existent - java

If I remove a method, the error (elsewhere in code due to no method existing) is not displayed until I manually build project. There is no way to get this to autobuild on save/change ?
Is there an option I am missing somewhere ?

You may try IDEA 12 EAP, it supports background compilation. See http://blogs.jetbrains.com/idea/2012/06/brand-new-compiler-mode-in-intellij-idea-12-leda/ for more details.

Yes there is, the Eclipse Mode plugin. It lets you always compile in the background, like Eclipse does. Works like a charm.
Apart from that: in IntelliJ, don't just delete a method manually, use Refactor > Safe Delete .... It will walk you through all places in your code where the method is used. That's the IntelliJ way to do it.

Related

Eclipse debugger does not recognize new java code

I have added new method to my javacode and put breakpoint at the begin of this method and different places. Eclipse debugger go throw the breakpoints in the old code but not in the new added method. I have cleared my project project-> clear to exclude the cache possibility. for me, it appears that eclipse dont recognize the new added Java code.
Any Idea what could be the problem? I use eclipse Juno Service Release 2.
You need to stop debugging and start the program again since the signature has changed. If you want more hot-swap possibilities you need to consider using JRebel or similar tool.

Eclipse code completion automatic deactivation

Whenever I run Eclipse, it suddenly deactivates some completions tags (but not all) with no reason. This happens always during, when I write some code. At the start of Eclipse, everything is okay but after a while this problem occurs. Every time I solve this by resetting the preferences and restarting Eclipse. But it takes too much time and annoys me.
Is there a special Hot-Key to (de)activate some completions tags?
I would bet on a plugin malfunction. Try to reinstall Eclipse from scratch without any custom plugins, and add only what you need, then add them one by one until you run into this problem.
Alternatively, open Eclipse->preferences->install/update->unintsall or update (link)->configuration->view error log and see if you get any exceptions on any plugins, if you identify something fishy, uninstall that plugin.
In my case the Eclipse Preferences named Type Filters (under Java | Appearance) seemed to cause that experience. We had excluded all common root package names (com., org., sun.), but also java. and javax.*. After deaktivating those entries in the "Filter list" Eclipse's Ctrl-Space again provides the missed proposals.

IntelliJ IDEA "Make project automatically" woes

Back in December I switched from Eclipse to IntelliJ IDEA but within a couple of days I switched back. Today I tried IntelliJ again and basically I have only one issue left.
The issue is I want to compile Java classes on saving. The reason is I'm using JRebel which will pick up the new class. I don't want to hit ⌘+F9 every time to compile the changed class.
I read about the EclipseModel plugin but this does not seem to work (anymore) as can be read in the comments on the plugin's page: http://plugins.jetbrains.com/plugin/?id=3822
I also tried the "Make project automatically" but this compiles ALL classes and not only the changed class. This is only not more time consuming it will also cause JRebel to reload all classes.
Any suggestions?
I ended up creating a Macro which does the Save and the Make Build.
I then assigned the Ctrl+S shortcut to this Macro and then it works fine.
What if you just remap the keys from Ctrl+F9 to Ctrl+S? Basically you will just keep up with the habit of pressing Ctrl+S since you do that in Eclipse - just a matter of pressing a different key in IntelliJ.
IntelliJ IDEA 12 indeed comes with out-of-process compiler which compiles the project classes automatically, but it seems to be unpredictable - you might refresh the page and the class is not yet compiled. So in the scenario with JRebel the off-process compilation is no use, unfortunately.
This may not be exactly what you want but normally I leave auto-save on, and when I need to compile the current class I'm working on, I just do Ctrl + Shift + F9.
My IntelliJ IDEA version is 2017.3.4, and I modified some values so that it compiles automatically.

IntelliJ. Debug a program even if it does not compile

I have a Java project in IntelliJ that compiles, and now I am slowly changing.
Is there a way to ask IntelliJ to run the project, even if some parts of the code still do not compile? If so, how?
Why I would need this, you ask? see this ticket:
IDEA-61945 Run and Debug commands should ignore compile errors not related to the main being run.
http://youtrack.jetbrains.net/issue/IDEA-61945?query=it#tab=Comments
Please, do not answer this post questioning whether I should or I should not need to run a project even if it does not compile. please.
If not possible in IntelliJ, is it possible in maven? How?
In Intellij 12 you also have the following option (which personally I find the best one):
Go to Edit configuration of your launcher
Go to the before launch section
If 'Make' is in the list: remove it
Add 'Make, no error check'
Now, when you run, a make will still be done automatically but the run will continue even if the are compilation errors.
Regarding the above debate; I think it makes perfect sense to be able to run a part of the code that does compile even if another part of the code does not not; e.g. if that other part of the code belongs to a module that is in your project but not involved when running.
I ran into this exact same problem at work today. Before now, I probably would have been quick to jump on the bandwagon of, "Why would you ever want to do that?" Turns out that Eclipse lets you do exactly this, and if you start working concurrently with other developers who depend on this feature (which is to say, check in code that doesn't compile), it's handy to be able to do the same in IDEA!
And lucky for us IDEA users, you can. Follow these instructions from the FAQ for Eclipse Users, and you're good to go:
To be able to run code with errors, you can select the Eclipse
compiler in Settings dialog, Compiler, Java Compiler and add the
-proceedOnError option to the Additional command line parameters for the compiler.
The only thing that's lame is that it's not quite as seamless as in Eclipse. First, you'll have to untick the option to Make before run because IDEA won't run if make fails. Then, you'll have to remember to build before running. With those caveats, though, you should be able to accomplish what you're after.
Stijn Geukens's answer is correct, but it can be improved.
In Intellij Idea version 12 instead of removing the "Make" rule it can be replaced with "Make, no error check". This way project will be rebuilt (compiler will atempt to do it), but it will run the program independently of compile outcome.
If you want to debug just one part, then you can create a unit test around that. If you do not use the class that does not compile, then you can still debug the unit test related code.
When there are compilation errors, you can exclude specific files from compilation.
Go to the Messages window (if it is not visible: View -> Tool Windows
-> Messages)
Right click the problem file
Exclude from compile
At least in Intellij 12 you can achieve this.
First try to compile the project, including the broken class(es).
Then in the Messages view, containing all the compile errors:
Right-click the class you want to exclude
Click 'exclude from compile'
See this question on how to reinclude afterwards.
For Intellij 2017.3.1 my configuration is like this:
Use the Eclipse Compiler: Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Use compiler: Eclipse
Select "Proceed on errors"
Edit your desired configuration defaults (I use this for JUnit) before launch to Build, no error check: Check this screenshot
Additional step in order for Intellij not to open the classes with errors when you run your configuration. Un-select Automatically show first error in editor in Settings -> Build, Execution, Deployment -> Compiler
PS: This configuration is not perfect for all usages. It only works when you are fixing unit tests that were failing because of your changes in implementation code. When you go back to implementing features it is more useful to disable this feature since it will let you run you implementation code with errors and it will not jump to compilation errors. You need to go back and forth with changing the Eclipse compiler with the Javac one for best results.
Wow, it's been a while since I've been in IntelliJ and I miss it dearly! From my recollection you should be able to right click the main method in a module and run it directly so long as the remainder of the files in the module compile. I don't think it matters that a second module in the same project has errors. Is that not working for you?
updating for version 2017 - 2.5 community as menu options are slightly different
Navigate to:
Run>Edit Configurations
near the bottom of the Run/debug config window look for
"before launch: Activate tool window "
the field below this heading lists your current build config settings.
Use the + and - symbols in order to add and remove build preferences.
Once completed
Select apply then Okay
Thats it!
I don't think its possible at all. How you can run something that doesn't compile? That would be like driving a car that isn't put together. You could comment out the files that don't compile, so that the project compiles....
Edit -- or you can have Intellij not count the file as source by
Right Click on your project -> open module settings -> select your module -> select the file -> excluded

Eclipse won't check for errors in my code (Java EE)

I have been trying to use Spring in my Java EE projects and while everything will compile just fine for some reason Eclipse just refuses to do any sort of live error checking like it normally does. you know like underlining a line of code that is totally wrong for ex:
System.BananaBoat.SetSail();
Obviously this class doesn't exist but Eclipse isn't throwing any sort of error at all. It just lets me do it. Is there something I need to enable to make sure that this is getting tested? Is this related to the incremental compiler?
Any insight on this would be great. Feels like being back in the stone age without this.
Check if the project has any problems in the "problems" fast view. Sometimes, Eclipse refuses to build automatically if there is a problem such as a cyclic module dependency, or some required .class file being referenced indirectly.
Here are some links:
Eclipse Problems View not showing Errors anymore
Best Practices for Eclipse's Problems View
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/cprbview.htm
Make sure that the automatic build isn't turned off.
I found this answer somewhere else.. Anywho, make sure your files are under the "src" file under your project, I had mine in another folder, for some reason eclipse will refuse to error-check in a place other than the src folder.

Categories

Resources