Copy two versions of same jar using maven

时光总嘲笑我的痴心妄想 提交于 2019-12-23 04:36:17

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/9308366/copy-two-versions-of-same-jar-using-maven

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!