How to add a fat/uber jar as dependency in pom.xml

332 Views Asked by At

I'm newbie on maven.

My question is this:

I have a far jar in nexus, and want to add it as dependency in a pom.xml. How can I do that?

enter image description here

In nexus there are both the jar and the fat jar.

Inside my pom.xml I'm using:

<dependency>
        <groupId>com.xxxxxxxxxxxx.sar</groupId>
        <artifactId>kafka-connector</artifactId>
        <version>5.0.0-SNAPSHOT</version>
    </dependency>

and, of course, it is not downloading the fat jar. How do I fix that?

2

There are 2 best solutions below

1
Abdelkader Chhaibi On

add the dependency to your pom.xml

<dependency>

<groupId>com.xxxxxxxx</groupId>

<artifactId>example-app</artifactId>

<version>1.0</version>

<scope>system</scope>

<systemPath>${basedir}/lib/yourJar.jar</systemPath>
1
khmarbaise On

Using a classifier is the right way to go:

<dependency>
  <groupId>com.xxxxxxxxxxxx.sar</groupId>
  <artifactId>kafka-connector</artifactId>
  <version>5.0.0-SNAPSHOT</version>
  <classifier>fat</classifier>
</dependency>

I would check if the fat is a consumable artifact.