Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference to a shaded jar in maven

I have a mavne project installed a shaded jar into local repo. in the repo, there are jar and shaded jar :

myjar-1.0-shaded.jar

myjar-1.0.jar

myjar-1.0.pom

In another maven project, I want to add dependency to that shaded jar

how can I do it ?

I tried

<dependency>
    <groupId>mygroup</groupId>
    <artifactId>myjar</artifactId>
    <version>1.0-shaded</version>
</dependency>

But it does not work, just can not find the jar.

Of cause directly use version 1.0 will find that jar but will cause some package conflict.

Not sure whether it is a good idea to have dependency to a shaded jar, but in my case, I have to do it. If anyone can figure out how to solve this, I will be very thankful.

like image 588
John Zhao Avatar asked Aug 03 '15 23:08

John Zhao


1 Answers

Try:

<dependency>
    <groupId>mygroup</groupId>
    <artifactId>myjar</artifactId>
    <version>1.0</version>
    <classifier>shaded</classifier>
</dependency>
like image 105
heenenee Avatar answered Nov 23 '22 23:11

heenenee