I'm creating a library "A" that imports dependency "B". When I include library "A" in a project, I get a ClassNotFoundException
if I also don't explicitly include dependency "B" in the project's pom.
When importing dependency "A", is there a way to tell Maven to automatically include all the its dependencies including "B" (without manually declaring to import "B", since it's already in the pom.xml
of library "A")?
Transitive dependency are added by Maven automatically. If you go to a dependency loaded in local repo you will see that near the artifact (typically jar) there is its pom.xml which describes the jar dependencies. If you are using Eclipse open your project pom.xml and go to Dependecy Hierarchy tab there you will see all dependencis including transitive ones.