Eclipse,如何将一个项目的所有依赖项添加到另一个项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11327361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:28:05  来源:igfitidea点击:

Eclipse, How to add all dependencies of one project to another

eclipsedependencies

提问by Hashken

I have a project in Eclipse which I built using Maven and it has hundreds of JARs as reference libraries. Is there a way to include all these reference libraries to another project?

我在 Eclipse 中有一个使用 Maven 构建的项目,它有数百个 JAR 作为参考库。有没有办法将所有这些参考库包含到另一个项目中?

回答by Hashken

Since the original project involved Maven dependencies, there are two ways of doing this.

由于原项目涉及到Maven依赖,所以有两种方法。

- Maven

- 马文

To accomplish this in Maven style refer to this question. How to add "Maven Managed Dependencies" library in build path eclipse?

要以 Maven 风格完成此操作,请参阅此问题。如何在构建路径 eclipse 中添加“Maven Managed Dependencies”库?

- Adding a project as dependency

- 添加一个项目作为依赖

The more simpler way of doing this (for beginners and testers), is to just include the original project as a dependency to the new project.

更简单的方法(对于初学者和测试人员)是将原始项目作为新项目的依赖项包含在内。

  • In your original project, travel to Properties > Java Build Path > Order and Export. Select all the dependencies that you want for your new project.
  • In your new project, travel to Properties > Java Build Path > Projects. Now add the original project.
  • 在您的原始项目中,前往 Properties > Java Build Path > Order and Export。选择新项目所需的所有依赖项。
  • 在您的新项目中,前往 Properties > Java Build Path > Projects。现在添加原始项目。