How to generate class files to target\*.* on the fly so JRebel can reload class files

I've used JRebel with eclipse in the past without any issues; I set "build automatically' and point the output directory to maven default target class and as such I'm able to change the java files on the fly and allow JRebel to reload the classes.

In Idea, however, I'm unable to compile classes on the fly since the default Ajc compiler doesn't seem to compile classes on the fly. I'm not sure if changing to eclipse would help since I'd need Aspectj support.

I've made sure all my module settings are configured to have 'use module compile out path' check to  .... {target\classes}

What am I missing?

The other alternative is to run maven build but it takes a long time, even without tests, since I have 18 modules to run.

20 comments
Comment actions Permalink

I don't see from your post - have you installed JRebel plugin for IDEA? Though on-the-fly compilation isn't supported by IDEA, the plugin should be able to reload updated classes after you say compile (Ctrl-F9).

IDEA itself also has a HotSwap feature (works if you started your project in a debug mode).

0
Comment actions Permalink

Yes, I'm using JRebel's official plugin. The plugin itself is working fine since it works when I start my tomcat (I can in the logs). The problem is with the IDE because Jrebel looks at the new classes in the target/classes structure and IntelliJ doesn't generate one.

In eclipse, this happens automatically.

Could it be because I use Ajc compiler?

0
Comment actions Permalink

You can just reassign Ctrl+F9 to Ctrl+S and that will seem like if you work with Eclipse :)

0
Comment actions Permalink

That is NOT the same as eclipse a Ctlr F9 'Makes' the ENTIRE project and I have 18 maven modules :)

Besides Idea 'Make' still doesn't work all the time as I use aspectJ, oh, well -- let's not get there as I just closed another thread last week.

How do I complile just one class?

0
Comment actions Permalink

Perfect. Thanks.

0
Comment actions Permalink

How do you 'assign' Ctlr S ==> Ctrl Shft F9 (or any other keymap)?

0
Comment actions Permalink

Settings -> Keymap

Or you can actually press Ctrl+` (backquote) and in the the popup select Keymap and Switch to Eclipse shortcuts :)

0
Comment actions Permalink

I'd like to migrate to Idea's keymap and it'd help to have the option of assigning shortcuts in the interim.

0
Comment actions Permalink

Thumbs up! :) Then Settings -> Keymap is where you find the assigned shortcuts.

0
Comment actions Permalink

Hi to all.

Ctrl Shft F9 works for all java files, but doesn't work for resources. 

How can I put all updated resources to target/class directory?

0
Comment actions Permalink

For resources, you can mark the directory where files are located as the "resources" directory: right click -> Mark Directory as -> Resources Root

The files will then be copied automatically to the target.

0
Comment actions Permalink

It'd already marked as resource root, but files coping only on rebuilding whole module, but I want on changes. Same as automatic build on save in Eclipse.

Is it possible?

0
Comment actions Permalink

Did you enable "Build project automatically" in the compiler settings?

Settings -> Build, Execution, Deployment -> Compiler 

0
Comment actions Permalink

I've added it, but it didn't help =(

It looks like this feature doesn't work.

0
Comment actions Permalink

Verified - works for me. Try harder! :)

0
Comment actions Permalink

BTW, if you are using JRebel, you don't need the resources to be copied into the target directory. Instead, you can map them in rebel.xml file within the classpath element (if that was your original goal).

0
Comment actions Permalink

Thank you, it looks like that I need.  I'll try to do it.

0
Comment actions Permalink

Alexey,

Ctrl-Shift-F9 works perfectly for resources. Would be great if you could create a sample project to reproduce the issue.

0
Comment actions Permalink

Roman,

I've created sample project, and it's works fine

Thank you.

0

Please sign in to leave a comment.