Maven- Remove a Jar while building from lib folder

1.3k views Asked by At

i have added a jar like below

<dependency>
        <groupId>com.ibm.ws.runtime</groupId>
        <artifactId>com.ibm.ws.runtime</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/WebContent/WEB-INF/lib/com.ibm.ws.runtime.jar</systemPath>
    </dependency>

but in the war file creation , i don't want this in the lib folder. I know that scope tag with provided value would do that, but here the scope is already defined as system. Could you please guide me how to achieve this ?

1

There are 1 answers

2
Gayan Mettananda On BEST ANSWER

In your maven-war-plugin add the following to exclude the jar file from packaging.

<project>
...
<build>
    <plugins>
    <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
            <packagingExcludes>
                WEB-INF/lib/com.ibm.ws.runtime.jar
            </packagingExcludes>
        </configuration>
    </plugin>
    </plugins>
</build>
...
</project>