Reputation:
I have my project structure something like this.
|--utils
| |
| |--MyFileReader.java
But I want to change it into this one.
utils
|
|--readers
| |
| |--MyFileReader.java
Can anyone tell me the preffered way to do that with intellij preserving all dependencies and usages?
Upvotes: 0
Views: 820
Reputation:
After spending some time in searching and @morpheus05 answer with link helped to summarize two ways (AFAIK)
Method One
Right click the class in the project explorer and Refactor -> Move
or Select the Class in the project explorer press F6
Then select To Package
enter the new package name and press Refactor
button.
Method Two
Just change the package statement in MyDBReader.java from package daos;
to package daos.readers;
, then you will see red line under the package statement, place the cursor on the statement then do ALT+ENTER then select 'Move package to daos.readers'. This method only changes the package but does not update the usages
Upvotes: 1
Reputation: 4872
Just do it: Create the package, and drag and drop the class inside the new package. Intellij will do the rest. (link to help)
Upvotes: 1