This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.
The current project I’m participating in has such structure:
- Project 1
- depends on
- checks if object is
instanceof SomeClass(mentioned below)
- depends on
- Project 2
mvn clean package, the error below shows up:
cannot access org.springframework.ws.client.core.support.WebServiceGatewaySupport
and the error’s line refers to where
instanceof SomeClass is written.
External Libraries in IntelliJ IDEA, seems like libraries related to
spring-boot-starter-web-services simply just didn’t show up. Adding
spring-boot-starter-web-services in project1’s pom fixes this but it seems confusing because project2, which project1 depends on, already has that in its pom.
Is this intended behaviour of Maven? Does Maven install dependencies of dependencies? Or is there something I still need to configure to make this work?
It depends: usually maven cares for transitive dependencies.
But if your Project2 is
- neither available in a remote Repo (because you didn’t
- nor in the local Repo (because you didn’t
- nor you have it as sibling module in a modularized project
or you didn’t update (in the cases of 1 and 2) it for a long time there, maven could try to work with an old version of the poms that might not yet contain that dependencies.
Another source of problems could be if Project 2 declares its dependencies in the maven scope of
And you wrote that Project 1 depends on Project 2 “through IntelliJ IDEA project settings”. This is not sufficient for maven to resolve dependencies, you have to declare the dependency in the maven pom.xml!
Answered By – cyberbrain