Maven dependency resolution
I am creating two projects with Maven.
Project1 and Project2.
I have a dependency with jar1.jar to create Project1.jar. Also, I have dependency with Project1.jar to create Project2.war. I'm providing "provided" scope for Project1.jar dependency entry in Project2. Also, I am giving "compile" scope dependency for jar1.jar dependency entry in Project1.
What开发者_JAVA百科 I am getting is, the jar1.jar is also getting included inside the Project2.war. But jar1.jar is provided by the environment at which Project2.war gets loaded.
You could do a couple of things.
You could make the scope of jar1.jar
as provided
in pom.xml
of Project1
. Dependencies with provided
scope are included in compile classpath.
You could explicitly exclude jar1.jar
when declaring the dependency for Project1
.
精彩评论