且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 Ant 为具有外部 jar 依赖项的 java 项目构建可分发的 jar

更新时间:2022-02-25 06:13:29

您的 build.xml 中有两个选项.您可以解压库 jar,然后将它们的内容与为您的应用程序编译的代码捆绑在一起.或者,您可以将库 jar 放在文件系统上,并在 MyProject-2011126.jar 文件的清单文件中提供一个 ClassPath 条目.

You have two options from your build.xml. You can either unjar the library jars and then bundle their contents with the code compiled for your application. Or, you can put the library jars on the filesystem and supply a ClassPath entry in the manifest file of the MyProject-2011126.jar file.

如果您在清单中设置了类路径,请记住您提供的路径是相对于 MyProject-2011126.jar 的.

If you set the classpath in the manifest remember that the path you supply is relative to the MyProject-2011126.jar.