-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable compile-on-save by default in maven projects. #5826
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's a good thing to do.
Later on we probably should think about removing this feature. It was a big time-saver 10 years ago, but it is a can of worms now. Unfortunately this has more tentacles in the enterprise cluster as well.
I remember when I tried to implement this feature for Gradle, even had a semi-working branch as well, but couldn't get it right. Then Gradle continuous build option came out and the whole thing got obsolete.
With this change I have lost the ability to work with myBatis result maps in test classes. I had to turn compile on save manually on. org.apache.ibatis.io.ResolverUtil fails to detect classes properly if referenced projects go to classpath as their jars in repository vs target/classes directory (which is the result of compile on save option change). Please, never remove that option. |
@morvael you have more of an issue if your tests rely on having compile on save enabled! I would look at what's required to have them work correctly without it. |
MyBatis loads result map files from xml file in project's resources when loading its configuration. That file tells it about some aliased classes. And then it gets ClassNotFoundException for such class, because the ResolverUtil has not found it somehow. I checked run class command difference and classpath difference for the same code run in NB 17 vs NB 18 and the differences are:
And it is the second change that somehow prevents the MyBatis code from scanning them correctly and finding annotated classes. The same problem does not happen when the application is actually deployed on application server. It's only a problem inside IDE when trying to "Run" a class with main method. |
In NB 18 due to the swtich from target/classes to maven repository jar the second line will not appear, SomeClass will not be found by scanning, and thus ClassNotFoundException will be thrown when loading result map xml. |
I actually worked with compile on save disabled for a long time, since it caused some bug (long forgotten what it was), but the IDE simply used last version of target/classes from regular build and was able to scan them properly. Now it somehow can't do it when pointed to actual jar. |
SomeClass is in project A. main is in a test class in project B.
|
So forcing VFS class used by ResolverUtil to use DefaultVFS implementation for "run from IDE" classes ( |
- recently CoS fell more and more out of favour (see apache/netbeans#5826) --> let's try without it -- profile eclipse allows to use the Eclipse compiler which allows incremental compilation an might be faster
"good defaults" round two, see dev list or #5260
sets CoS default to
none
some reasons why: