Amarendra Reddy
Amarendra Reddy

Reputation: 243

Copy jars place in webapp/WEB-INF/lib to war under WEB-INF/lib using maven

I have added a dependency under webapp/WEB-INF/lib/ folder.

When i build using maven i want to copy it in the war at WEB-INF/lib instead of WEB-INF/classes/WEB-INF/lib. I am looking for this to be done using maven itself.

I have mentioned packaging as war in pom file.Still the dependencies are not being copied. Am i missing something in the pom file. I have copied the pom below:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>****</groupId>
    <artifactId>*****</artifactId>
    <name>****</name>
    <description>*****</description>
    <parent>
        <groupId>****</groupId>
        <artifactId>***</artifactId>
        <version>17.6</version>
    </parent>
    <properties>
        <jbpm.version>6.3.0.Final</jbpm.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.jbpm</groupId>
            <artifactId>jbpm-test</artifactId>
            <version>${jbpm.version}</version>
        </dependency>
        <dependency>
            <groupId>Assets.CKAF.Bundles</groupId>
            <artifactId>csf-kafka</artifactId>
            <version>1.2-0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.10</artifactId>
            <version>0.10.0.0</version>
        </dependency>
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>de.ruedigermoeller</groupId>
            <artifactId>fst</artifactId>
            <version>2.47</version>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.8.1</version>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-avro-serializer</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>common-config</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-schema-registry-client</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.8.7</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <version>2.8.5</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>jaxrs-api</artifactId>
            <version>3.0.7.Final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.19.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring</artifactId>
            <version>2.19.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache-extras.camel-extra</groupId>
            <artifactId>camel-jboss6</artifactId>
            <version>2.18.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.2.10</version>
        </dependency>
    </dependencies>
    <packaging>war</packaging>
</project>

Attaching screenshots of content of war.

war home folder WEB-INF content

Upvotes: 1

Views: 314

Answers (1)

RanjithKRaman
RanjithKRaman

Reputation: 46

Your POM seems fine. And since you haven't specified any "scope" to the dependencies, the default scope of "compile" gets applied which means once you do a "mvn clean install" for example, it should package all those dependencies into the "lib" folder of your war file.

The only other thing I see is you have a parent section in this POM and if you have these dependencies in the parent project and if their scope is "provided" then you wont see them under the lib folder of your war file.

Upvotes: 1

Related Questions