Hi, I am trying to work on the source code of SNAP using IDEA, configured as suggested on the wiki. When I change something in the code, IDEA is very quick at recompiling it, but if then I run the program, it still has the old behavior.
I believe this happens because the classes automatically regenerated by IDEA are not the same that re loaded by SNAP when configured as suggested in the wiki. I have to run the whole maven process in order to see the changes in the program. This is quite time consuming, and most of that time is not spent compiling (the Java compiler takes few seconds to update just one class, if I made a small edit), but copying and jarring files around in the maven directories and repositories.
Do you any tip about how to make the edit-and-run cycle quicker?
Unfortunately, this happens sometimes. It depends which modules you change and which files. For example changes at the layer.xml need a rebuild. We are also not happy when this occurs.
To make less annoying you definitely need to add the patches as described in the wiki page you have linked to.
Often it is also sufficient to call
mvn clean package on the module you have changed. This can be invoked from the maven window and added to the run configurations for easier access.
You mean the
--patches option? I did that. So what that option means is a directory from which to load classes, overriding the classes available in the JARs compiled with Maven?
Thanks for your help.
Yes, that’s what I meant.
You can also specify the
-T option when invoking maven.
-T 6 you tell maven it should use 6 threads. The best value depends on your CPU.
This option can also specified in IDEA.
Ah, now I see why it wasn’t working for me: I was modifying a class in
jlinda-core, which is one directory level further down than the general expression
<myprojects>/snap/s1tbx/$/target/classes which is suggested on the wiki. Adding
<myprojects>/snap/s1tbx/jlinda/$/target/classes (notice the additional
jlinda) enabled the program to find the different classes, and I was the difference.
I would suggest to add the same path on the wiki, for future users.
Thank you again for your help and for the other suggestions!
Yes, this was missing on the wiki page.
Thanks for finding the solution.
I’ve updated the wiki page.