raulgomis
raulgomis

Reputation: 115

Refactor packages when moving clases

I was wondering if there is a way to move clases form one package to another without refactoring package name.

And if possible, after that, do the refactoring of the whole packages and references of the application, maybe with an inspection or something.

Upvotes: 1

Views: 570

Answers (1)

vikingsteve
vikingsteve

Reputation: 40398

Ok here's a hacky way to move classes around without refactoring.

  • Above your source files, find the source root marked in blue. For example if you are using standard maven layout then it will be src/main/java - right click on java, select Mark Directory As -> Unmark as source root

  • Notice that your java files are no longer recognized as java source - you can drag and drop your files, and the package name should not be factored.

  • Remark your java folder as a source root - Mark Directory As -> Source Root

Hope this helps!

Upvotes: 2

Related Questions