简体   繁体   English

在Eclipse中打包项目

[英]Package projects in eclipse

Lets say I have n projects in eclipse and they are only conceptually connected. 假设我在eclipse中有n个项目,它们只是在概念上连接起来。

How to add every one of these projects as a package in a new umbrella project? 如何将这些项目中的每一个作为一个包添加到一个新的伞形项目中?

In Eclipse you can hook projects together using the Project tab in your build path configuration dialog: 在Eclipse中,您可以使用构建路径配置对话框中的“项目”选项卡将项目挂钩:

  • right-click on your higher-order project 右键单击您的高阶项目
  • select Build Path 选择构建路径
  • select Configure Build Path... 选择配置构建路径...
  • select the Projects tab and add the other projects as references 选择Projects选项卡并将其他项目添加为引用

You might also look into Maven as a build management system, which would allow you to create consumable libraries. 您还可以将Maven视为构建管理系统,它允许您创建可使用的库。 Each of your projects would use Maven to generate a JAR artifact, and your umbrella project would use Maven to reference them as dependencies. 您的每个项目都将使用Maven生成JAR工件,而您的伞形项目将使用Maven将它们作为依赖项引用。 I believe Ivy would also help you in this regard. 我相信Ivy在这方面也会帮助你。

In order to logically combine the elements (in this case, projects) together, you can create a "Working Set" in Eclipse. 为了将元素(在本例中为项目)逻辑组合在一起,您可以在Eclipse中创建“工作集”。 There can be different type of working set. 可以有不同类型的工作集。

Here are steps to create a Java working set (as the question is tagged as Java): 以下是创建Java工作集的步骤(因为问题标记为Java):

  1. File - New - Others.. 档案 - 新 - 其他..
  2. Select "Java Working Set" under Java. 在Java下选择“Java Working Set”。
  3. Select the project you want to add into the working set and give a 选择要添加到工作集中的项目并给出一个

Once the working set is created, you can use it at many place in eclipse. 一旦创建了工作集,就可以在eclipse中的许多地方使用它。 Personally I use them a lot in search to narrow the search results and on Package/Project Explorer to see only the projects I am interested in at the moment. 我个人在搜索中大量使用它们来缩小搜索结果,在Package / Project Explorer中只查看我感兴趣的项目。

To emphasize that the Java working sets are just logical grouping of the projects, here are couple of examples. 为了强调Java工作集只是项目的逻辑分组,这里有几个例子。

  • Working sets "Batch Projects" and "Web Projects" based on type. 工作集根据类型设置“批处理项目”和“Web项目”。
  • Working sets "SVN Projects" and "CVS Projects" based on the source repository. 工作集基于源存储库设置“SVN项目”和“CVS项目”。

Read more on the offical eclipse documentation. 阅读有关官方日食文档的更多信息。

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

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