Reputation: 559
I wanted to exclude the following dependency from final war build(using mvn package/install).
Which scope is preferable?
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
Upvotes: 0
Views: 70
Reputation: 12538
Depending on your target deploy server. If you're deploying on application server such as Glassfish
, Jboss
etc. with JSF libraries installed then scope
provided is preferred. Or alternatively use exclusion to remove the dependency from your target war.
Alternatively, if you are deploying on a context server such as tomcat
, jetty
etc. remove scope target to copy the library across to avoid dependency issues.
Upvotes: 0
Reputation: 67380
You have 2 options, provided
or test
. provided
will exclude the jar from the classpath in your tests, too. If you want to test code that depends on that dependency, you should use test
instead.
If you still see this dependency in your war file after installing we'll need more information to debug. It could be that you included this dependency more than once without realizing it. It could also be that another dependency is transitively including this jar and you'll have to use the exclude tag to remove it.
Upvotes: 1