简体   繁体   English

如何在导出项目归档文件中包含外部库

[英]how could I include external library in my export project archive

I'm trying to export my project to archive file by using eclipse. 我正在尝试使用eclipse将项目导出到存档文件。 However, as I included an external library, db4o lb so that my project cannot run unit test on the other computer. 但是,由于我包括一个外部库db4o lb,所以我的项目无法在另一台计算机上运行单元测试。 So I wonder how could I export my project to archive file that could include the external library in it so that people who import my project could just run the unit test without first change the build-in config. 因此,我想知道如何将我的项目导出到可能包含外部库的存档文件中,以便导入我的项目的人可以运行单元测试而无需先更改内置配置。 Thank you very much for your help 非常感谢您的帮助

just take a look at maven. 只是看一下行家。

You can otherwise put your project and associated dependency on a version manager (SVN, Git, etc..) and tell other people to checkout it from there. 否则,您可以将项目和相关的依赖项放在版本管理器(SVN,Git等)上,并告诉其他人从那里签出。

Google code is a good solution if you don't want to set up your own 如果您不想设置自己的代码,则Google代码是一个很好的解决方案

You can create a runnable jar in Eclipse -- there is an option to package required libraries to the generated jar. 您可以在Eclipse中创建可运行的jar –有一个选项可以将所需的库打包到生成的jar中。 For this, you need to have a run configuration, ie at least one of your classes should contain a main method. 为此,您需要具有运行配置,即,至少一个类应包含一个main方法。 The jar can be referenced from projects just like non-runnable jars. 罐子可以像不可运行的罐子一样从项目中引用。

Alternatively, these are ways to do it using Maven: Including dependencies in a jar with Maven 另外,这些是使用Maven的方法: 在Maven的jar中包含依赖项

and using Ant (Lucas Pottersky's answer): Eclipse: How to build an executable jar with external jar? 并使用Ant(Lucas Pottersky的答案): Eclipse:如何使用外部jar构建可执行jar?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM