I am new to Maven and am trying to understand transitive dependencies
and how to exclude them from my war.  

 

For example, in my war file, FastInfoset-1.2.2.jar file is included.  I
do not have it listed as a dependency in my POM, so it must be a
transitive dependency.  I ran mvn with the -X parameter and saved the
output to a file to see if I could glean which dependency is the
"mother" dependency.

 

The first time FastInfoset is noted in the output follows:

 

[WARNING] 

                Artifact javax.servlet:servlet-api:jar:2.4:provided
retains local scope 'provided' overriding broader scope 'compile'

                given by a dependency. If this is not intended, modify
or remove the local scope.

 

[DEBUG]       javax.servlet:servlet-api:jar:2.3:compile (removed -
nearer found: 2.4)

[DEBUG]     commons-logging:commons-logging-api:jar:1.1:compile
(selected for compile)

[DEBUG]     javax.el:el-api:jar:1.0:compile (selected for compile)

[DEBUG]     com.sun.xml.fastinfoset:FastInfoset:jar:1.2.2:compile
(selected for compile)

 

Does this mean that it is a transitive dependency of the
servlet-api.jar?  If not, how can I determine which dependency this is a
transitive one of?

 

In my POM.xml, here is the servlet-api dependency:

 

<dependency>

      <groupId>javax.servlet</groupId>

      <artifactId>servlet-api</artifactId>

      <version>2.4</version>

      <scope>provided</scope>

</dependency>

 

The servlet-api.jar is not included in my war (as expected).  Do I have
to add exclusions to this dependency for all its transitive
dependencies?  I would have expected that transitive dependencies would
be included/excluded as per the mother dependency.

 

Thanks in advance!

Reply via email to