收到一个主jar文件与其他jar文件需要在类路径。在我的maven项目中包含这个主要jar的最佳方式是什么? [英] Received a main jar file with other jar files that need to be in the classpath. Whats the best way to include this main jar in my maven project?

查看:183
本文介绍了收到一个主jar文件与其他jar文件需要在类路径。在我的maven项目中包含这个主要jar的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我从客户端收到了一个java api,主要的代码在main.jar中。但是,当我想要使用main.jar时,他给我的指令要求我将这些其他jar(a.jar,b.jar等等)添加到类路径中。这些其他支持罐子是Xerces,jakarta-oro和其他一些公开的库。问题是我不知道他们是什么版本,所以我不知道是否会有问题,如果我只是更新我的应用程序中的pom.xml文件,以依赖于main.jar,并且还具有这些其他jar的依赖以及最新版本。



在我的maven应用程序中使用main.jar的最佳策略是什么?我正在计划将main.jar添加到我们内部的maven存储库中,但是当我不知道它们是什么版本时,我应该怎么做xerces,jakarta-oro和其他jar呢?



感谢

解决方案

如果你幸运的是/ INF / MANIFEST.MF内部的a.jar,b.jar等包含一个条目实现版本或一些其他有用的信息,告诉你它们是什么版本。如果没有,您可以从项目网站下载最新版本,并检查它们是否与捆绑依赖关系具有相同的文件大小。
您可能也会想到将依赖关系与main.jar绑定在一个大型jar中,但是在将来的某个时刻,您的类路径中依赖关系会两次,这可能会变得有趣/ p>

只是问客户端这个依赖关系的版本号呢?


So i received a java api from a client and the main code is in main.jar. But the instructions he gave me require me to add these other jars (a.jar, b.jar, etc..) into the classpath whenever I want to use main.jar. These other supporting jars are things like Xerces, jakarta-oro, and a few other publicly available libraries. The problem is i don't know what versions they are, so i'm not sure if there would be issues if i just update the pom.xml file in my app to depend on main.jar and also have dependencies to these other jars as well with the latest versions of them.

Whats the best strategy for using main.jar in my maven application? I'm planning on adding main.jar to our internal maven repository, but what should i do about the xerces, jakarta-oro, and other jars when i dont know what versions they are?

Thanks

解决方案

If you are lucky the file /META-INF/MANIFEST.MF inside a.jar, b.jar etc. contains an entry "Implementation-Version" or some other useful information which tell you what version they are. If not, you can download the latest release(s) from the project web site and check if they have the same file size as your bundled dependencies. You may also come to the idea to bundle the dependencies with the main.jar in one big jar, but this may become funny, when you have the dependencies twice in your classpath at some point in the future...

What about just asking the client what version numbers this dependencies have?

这篇关于收到一个主jar文件与其他jar文件需要在类路径。在我的maven项目中包含这个主要jar的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆