Mad Scientist
Mad Scientist

Reputation: 917

Change many package names in eclipse

I have a maven project in eclipse which has many packages which have prefixes I want to remove. When my packages have the names:

x.y.a
x.y.b
x.y.c

etc how can I remove the x.y. from all package names? It would take too much time to change every single name so I hope there is a way to change all together.

Upvotes: 0

Views: 36

Answers (1)

Duncan Krebs
Duncan Krebs

Reputation: 3502

In Eclipse, open your java perspective by going to window -> open perspective -> Java. Then in your package explorer on the left side that shows all your packages there is a drop down icon third from the right, select that drop down then select package presentation -> Hierarchical. Right click on package a,b,c and select refactor -> rename in the name you will see x.y.a just change the name to a and do the same for package b and c. Once you refactored packages a,b,c from x.y then right click on x and y and select refactor -> delete

Upvotes: 1

Related Questions