Good day.
There is such a situation. There are a number of classes in the project; you need to reuse these classes in other projects. The problem is that I cannot figure out how to make these classes add to other projects as links (if possible ?!), so that when these classes change, in other projects these classes also change. Tell me which way to dig, or maybe there is a simple way to organize this access in a few clicks? %)
1 answer
Hello.
Perhaps you need those classes that you want to use in other projects, put in a separate project. Then collect it in the jar and connect as a dependency to all projects where it is needed.
If it is on an eclipse, then suppose that project A is a project with general classes, and project B is the project that needs these general classes. So, we open project A and B in one workspace, then go to project B settings (alt + enter on project) -> go to the Java Build Path and add project A to the projects tab. Then go to the last window tab (I do not remember how it is called) put a tick on the project A, so that it gets into the assembly, if you collect the project in war or ear. Like that.
Hope this helps.
- Thank you, I already did. I just wanted to do without jar. That is, it turns out, if I make changes, then it is necessary to rebuild the jar, and so every time. ))) - Blajimir
git, then look towardsgit submodules. Forhg, there are also analogues. In the case ofant/maven/sbt/gradle/ etc, put the common code into a separate artifact. - falstaf