javamavenjarbuildgeronimo

How to exclude a package from a jar (with maven)


I want to exclude the geronimo-javamail_1.4_spec jar from my project, I am using maven to build the project, I saw this article and I added the exclusion part to my pom.xml but somehow after I build my project I see the geronimo-javamail_1.4_spec-1.7.1.jar in my war file's WEB-INF\lib.

Please tell me how can I exclude this jar from my .war.


Solution

  • <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-javamail_1.4_spec</artifactId>
        <version>1.4</version>
         <scope>provided</scope>
    </dependency>
    
    
    This way the maven will add them to the compilation classpath, but will not package them