Is there a way to reflect the changes done in a java project(in Intellij) while debugging/not debugging without having to rebuild the project - intellij-idea

I have a project that takes quite sometime to build and it becomes difficult to rebuild again and again after testing if I do some fix. I was wondering if there was a way in which I could do the hot fix test it without having to rebuild whole module. I am using Intellij. Any help is highly appreciated.

While debugging you can change the values with Intellij and apply them before the line is executed without the need to recompile. Here is the official documentation from Intellij.
While not debugging it's kinda impossible unless you use a plugin, for example, you can hot reload using JRebel

Related

How to troubleshoot React Native build error?

Below you can see the output I get when I try to run npx react-native run-android. It suggests some options to try in order to further pinpoint the problem, however they don't work with the aforementioned command so I assume that they are related to a gradle (just an educated guess).
I know ZERO about gradle; I have just seen the name here and there and in the output shown below. So please keep that in mind when you answer. If I need to learn how to run some gradle command(s) directly, please be as verbose as possible in your answer.
The project was working fine just a bit ago, but I wanted the ability to force portrait mode for certain screens but without configuring my entire app to always have to stick to portrait mode. So I found what looked to be a solution in the react-native-orientation-locker module. I installed it with yarn and then proceeded to update files as directed: https://www.npmjs.com/package/react-native-orientation-locker.
After updating the appropriate files, I got an error that suggested axios was the problem. I uninstalled and reinstalled axios. After that didn't work, I proceeded to undo all the file changes I had just made. Then I uninstalled the react-native-orientation-locker module.
To my knowledge, I have undone everything I did between the time the project worked and stopped working.
Sadly, I had not put this into source control yet (a mistake I won't make again), so I can't revert.
Where to go from here?
Problems like this are hard to pin point. What you can do is open the android project in android studio and see the logs as the project is being assembled. I assume you do not have much knowledge about android either so you might need some senior resource to help you.
What I usually do in this case is open android studio and if I am lucky enough, it tells me which file has an issue and I go to the file and do what android studio suggests me. Some times it fixes the problem and sometimes it doesn't.
Another thing I would like to mention is that the documentation of the package you are using is important to follow. I assume you did that already but I would suggest to review it narrowly and closely.
Another guess I can tell you is try to go to your-project/android/build.gradle and over there, you'll see something like this in the start. The package you are using mentions something about target SDK 27. I think you should check that out too. May be it helps
Lastly I would say always use source control while working with react native. It can easily blow up at any time so you should always have a safety net to fallback to :)

Intellij 2018.2 stops working and exits on MacOs. What might be a problem?

As an daily IntelliJ user you usually concentrate on the projects you are working on and IntelliJ is just a tool. You are not willing to dig into tool's problem itself. But this is what is forced on you by default after IntelliJ installation on MacOS and opening relatively big project(most of the projects nowadays are huge and have thousands of files and use numbers of IntelliJ 3rd party plugins).
Here is a minimal list of actions. IntelliJ must have set MORE RAM to be used by default.
Read: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files .
From IntelliJ open Help / Show log in Finder and open idea.log file with Console.app; In Console.app press "Reload" and "Now" buttons to track "live" what IntelliJ is doing.
If in logs of IntelliJ you find that some of the plugins exit with fatal error, you just uninstall those plugins. For me the one that failed to the moment of this answer was "BashSupport" as example.
Start Terminal.app ; Run command: open -a TextEdit /Applications/IntelliJ\ IDEA.app/Contents/bin/idea.vmoptions ; Change options in idea.vmoptions file to:
-Xms1024m
-Xmx2048m ; Read https://www.jetbrains.com/help/idea/tuning-the-ide.html to see how you can tune IntelliJ for your project. This step is handy when your IntelliJ app doesn't start at all and you want to change properties in a global way.
From IntelliJ open Help / Edit Custom Properties.... Here you can set same properties that will override global and will work only for current OS user.
Also there is also a possibility of underlying OS to do it voodoo magic so the IntelliJ won't work as it should like here - https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000398280-IDEA-Ultimate-2018-2-Unable-to-save-settings-Unable-to-create-file-Windows-10
Make sure your project build output for *.class files is set. Read: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000000584-Build-does-nothing . In my case when IntelliJ started project build it terminated without warnings shortly after.
Finally in my case none of 6 steps above solved the issue so I found this read: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000532044-IntelliJ-cannot-build-projects . Basically try reinstall IntelliJ from original distribution again.
I know that you must read https://www.jetbrains.com/help/idea every time you install a new version of IntelliJ, but why not to add some consistency into configuration process of the main java process that runs IntelliJ itself? You can ask how much ram to use during installation of IntelliJ and explain why it is so. Then Help digging won't be necessary in the first place for devs who fed up with changing those default settings that will be always more than 700MB. I think for most devs out there it is at least 10x of that. I bet what makes most devs mad about this is not the fact that you need to do some options changing, but where those options are depending on OS plus the fact that you simply forget why IntelliJ app just exits while you are doing a debugging of your own app. I bet this problem makes us mad since first java based IDEs appeared. User-friendly is the key here and explicit reminders within the app itself would help.

Why does IntelliJ show error for my JavaScript scratch file?

I use scratch files extensively but suddenly today I'm seeing an error. This is making formatting/linting not work or be effective, but the code executes just fine if I run the scratch file.
It does not matter which JavaScript language version I select when creating the file.
Version: IntelliJ Ultimate 2017.1.4
Known issue, please follow WEB-24263 for updates.
For now, I'd suggest choosing 'ECMAScript 6' language when creating new scratch file

Why does IntelliJ IDEA 13.1 show sbt files with so many lines in red?

I had a working sbt based project. After some small change that I can not specifically identify all the sbt files are having object resolution issues (see screenshots).
I tried the following:
sbt refresh
project rebuild
reimport project
These did not work.
Then I started going farther afield to resolve the issue. I copied the *.sbt files from another project on top of the ones in this project. Still no dice. Now I do not have time presently to actually completely destroy, rebuild the project from scratch - and in any case that does not lead to any insight on the root cause here.
Has anyone experienced this issue - and any suggestions on remedies/workarounds?
Update I finally tried
sbt gen-idea
even though this project was **not ** built that way.. It did make a difference: at least the crazy errors went away. But now a different set of problems arises: the assembly and packaging imports are not being resolved (see LAST screenshot). But this seems a bit more healthy at least .
Following screenshot is after running sbt gen-idea. Situation has improved but now get assembly/packaging import errors.
Another update
OK, I have quit and restarted IJ and things are finally back.
So the objective changes that I made:
sbt gen-idea
stop/restart IJ
This is feeling like magic incantations here .. Not a solid process.
A sort of a workaround could be to upgrade to the latest EAP of IntelliJ IDEA 13.1.3 build 135.909, released on May 23rd, 2014. It comes with more sophisticated Scala plugin that is much clever than the previous versions and hopefully could help here and there.

DropWizard testing

As I am using eclipse and just set up a dropwizard server. On the command prompt I typed in java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml and is running. Yet when ever I make a change to my eclipse file, like changing the yml file for example it doesn't update. I have to crtl+c and re-run what I typed in above. My question is, is there a faster way of testing so that it updates every time I change something or I just have to deal with the testing. Thanks.
Run from within the IDE
Different Java IDEs permit more efficient workflows. For example, in an IDE you can run up your application using a Runtime Configuration that executes your Service.main() method with parameters of server hello-world.yml. This will save you endless Maven builds.
Unfortunately, with Eclipse the hot swapping of code changes is often cumbersome, so I would recommend that you consider Intellij which is more reliable when it comes to hot swapping code. Even then hot swapping can be risky.
Sometimes a restart is unavoidable
That being said, in your situation hot swapping won't help. You are changing the startup configuration file which is only read at startup. You will have to restart to see the changes unless you create your own dynamic-refresh-on-file-hash-change mechanism (not advised).
One alternative is to put much of your configuration testing in unit tests and verify that your code is responding as expected.
Static assets give an optimal workflow (no restarts)
You may encounter a situation where you only want to change static assets (like JavaScript files) in which case Intellij will allow you to simply recompile on the fly and will copy the changed assets into the /target directory and have them immediately picked up by Dropwizard without a restart.
If you wanted to go one step further you could enlist the services of Grunt.js so that it continuously monitored the src/main/resources/assets (or similar) for changes and then automatically update your /target for you. Again, Intellij will autosave on focus change so this would lead to an optimal workflow where you change the asset, wait one second, refresh browser and see the immediate result.
I wrote a lengthy blog article covering Dropwizard and Ember Data a while ago if you want more details on this approach (and single page web application development in general).