Reputation: 14678
I have a Java project X that is functional and great. I am using netbeans as an IDE. I want to create project Y which basically is based on project X (it uses 80% of it but adds/and remove things).
I read on the web that it is best to add project X as a library to project Y and continue from there. However the problem is that if I change one thing (say add a variable to a class) then all the calling classes calls the original class unless I copy all the calling class over to "point their import to package Y"
The main issue I am running to. I have my class Common. This class is being called pretty much by every class ( singlton). I need to add functions to it. If I modify it and copy it to project Y then how can I tell the files in Project X to use this modified class in project Y?
Upvotes: 0
Views: 271
Reputation: 703
I would like to suggest something similar - yet different - that involves some work from your side, but I've seen it work great in very big projects.
Let's assume old project X and new project Y.
You should make some decisions about the critical parts that will be used by both projects. When you've taken your decisions, it's time to split the codebase.
I would propose that you create a third project - let's call it Z - which will be used as a common JAR in both projects. In that way, you will have clearly separated the parts of code that are different and you could easily add functionality to both projects if needed!
I hope this helps with your problem!
Upvotes: 1