5

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.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
John Zhao
  • 73
  • 1
  • 5
  • Your jar version is still 1.0, not 1.0-shaded (it is what's in the pom). How did you "installed a shaded jar into local repo"? Manually? How does the pom of my jar look like? – Boj Aug 04 '15 at 01:17
  • I just run mvn package, it will generate the normal jar and shaded jar. Then I run mvn install, I found both of them are installed in my local repo. – John Zhao Aug 04 '15 at 01:18

1 Answers1

9

Try:

<dependency>
    <groupId>mygroup</groupId>
    <artifactId>myjar</artifactId>
    <version>1.0</version>
    <classifier>shaded</classifier>
</dependency>
heenenee
  • 19,914
  • 1
  • 60
  • 86