Search code examples
mavenjardependency-management

External JARs are not present in WAR


I have to use JAR's which don't exist on Maven repo.

I did that by creating libs folder where I put my JAR's and after that I went into pom.xml and did this:

<dependency>
    <groupId>aaa.bbb.ccc</groupId>
    <artifactId>ABC</artifactId>
    <scope>system</scope>
    <version>1.0</version>
    <systemPath>${project.basedir}/libs/ABC.jar</systemPath>
</dependency>

And this works, when I execute mvn clean install I can see these external JAR's in my "Maven Dependencies" list.

However after executing Maven command these JARs are not vissible in dependencies list on my Application.war which was created in target folder.

Do you know why this is happening? I'm failing to understand it and I didn't find solution so far.


Solution

  • As khmarbaise said, solution to my problem was adding my dependencies to my local Maven repository instead of using system scope and system path properties.

    Guide for adding 3rd party JARs to your local Maven repository: https://mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/