Reputation: 1066
So I have a large Java project, which I'll call ProjectA. I have another project, ProjectB, which is a Maven project, and includes ProjectA as a dependency (by compiling ProjectA to a jar file). I also have many other Maven projects: ProjectC1, ProjectC2, etc. Each of these include ProjectB as a Maven dependency.
ProjectB contains code meant to be common/accessible to all of the ProjectC projects, as well as act as an interface to access some functionality from ProjectA. The problem is: in order to do this, I either have to write a method/class in ProjectB that explicitly calls/extends the method/class from ProjectA that I want to call, or I have to explicitly include ProjectA itself as a dependency in the ProjectCx project (which is undesirable due to the size of ProjectA).
Is there a way to access the members of ProjectA indirectly from ProjectC via ProjectB somehow?
Upvotes: 0
Views: 100
Reputation: 1066
Ok, I found the answer here: Maven and eclipse: a reliable way to add non-Maven or external jars to a project?
I added the Project A jar as a system dependency to Project B, and it picked up the transitive dependency in Project C.
Upvotes: 0
Reputation: 1777
if you defined B as a dependency in the pom.xml of project C. and A is a dependency in B. than in C you have access to A. thats what you call transitive dependencies in maven. meaning C automatically, even without writing project A in the c pom.xml, you get project A in your classpath. thats how maven works by default.
Upvotes: 0