For some external tool it is needed to keep several unused imports (but not all) in java classes. Is there a way to mark them to prevent deleting by IntelliJ Idea?
Asked
Active
Viewed 1,871 times
1 Answers
0
How to prevent IntelliJ IDEA from deleting unused packages?
Basically, you need to disable automatic import optimization.
-
No this is not a solution, because somebody with enabled this option simply deletes all files before comit. – Cherry Dec 08 '15 at 05:22
-
1@cherry this is the default. If you don't want it to happen, you have to turn it off. – pvg Dec 08 '15 at 05:23
-
@JonnyHenly probably, if I had those fancy superpowers but I don't. – pvg Dec 08 '15 at 05:23
-
It's actually better as an answer now that OP has clarified his question, via the comment on your answer : ) And you can flag this question as a duplicate via the [flag](http://stackoverflow.com/questions/34148529/hw-prevent-intellij-idea-from-removing-unused-imports#) link underneath the question's tags. – Jonny Henly Dec 08 '15 at 05:25
-
@Cherry that seems to be a problem with the communication and understanding between people that can comit to a repo, not a problem with IntelliJ IDEA. Although I agree the option should be turned off by default. – Jonny Henly Dec 08 '15 at 05:30
-
1@JonnyHenly there's probably a good meta-question there which is 'how to enforce certain IDEA defaults across a team' and 'turn these things off before they turns your SCM history into mashed potatoes' – pvg Dec 08 '15 at 05:32
-
how about changing the external tool which requires them? – slipperyseal Dec 08 '15 at 05:43