0

I am writing pom.xml for our project. I need to copy two different versions of same jar. But I searched maven docs and found that Maven has no support for this. Is there any other way to do that?

Note: Both jars have same groupid and artifact id.Only their versions are different.

Thanks in advance!

Ajinkya
  • 22,324
  • 33
  • 110
  • 161

1 Answers1

0

As you already know, Maven was designed to make sure that you will never have two JARs with the same coordinate (group + artifact id) but different versions on the classpath.

There is no way to achieve what you want without modifying the POMs of the JARs

So you need a workaround. Here are a couple of solutions:

  1. Give the JARs different classifiers. Typical classifiers are "tests" and "sources" but they can be anything.

  2. Move the version number to the artifact id and give the two JARs a new version.

For all approaches, you will need to download the JARs (and probably their POMs as well) and install them again using mvn file:install (after changing the POMs) or deploy them with mvn deploy:file if you run your own Maven proxy.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820