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

Time:03-29

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?

CodePudding user response:

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.

CodePudding user response:

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>
  • Related