I have been reading about why it is more convenient to structure the packages by functionality. I understand that it has greater modularity and that it is easier to navigate in the packages.
However, what happens with projects with modules by layers?
For example:
|example-webapp (com.company.webapp.feature1)
|-example-service (com.company.service.feature1)
|-example-data (com.company.data.feature1)
In this case, modularization with maven already separates the project by layers and internally by functionality, however the functionality is distributed in all layers, which I understand reduces the modularity. But in my opinion it is much more reusable, because if at some point you want to implement an API for example, you simply reuse the service and data modules.
So, in multi module maven project how can I strcuture by feature?
|example-webapp (com.company.feature1)
|-example-service (com.company.feature1)
|-example-data (com.company.feature1)
It is advisable not to consider the layers?