使用 Eclipse 和 Mercurial 进行项目设置

发布于 2024-10-16 16:04:24 字数 519 浏览 1 评论 0原文

我想要一些关于使用 Eclipse 设置多项目工作区的建议。换句话说,我打算创建一些应用程序,该应用程序将使用两个或更多项目进行最终构建。这些项目将存储在一些版本控制系统中。这很容易做到。

我正在寻求的建议是我应该如何设置版本控制或 Eclipse 工作区,以使设置新开发人员/新机器*变得非常简单。理想情况下,新开发人员或新机器上的开发人员只需发出一个命令(对某物:可以是 Eclipse、版本控制系统、某些构建系统,甚至是脚本);该命令将设置一个可以构建代码的环境。

如果这对解决方案很重要,我将使用 Java 作为语言,使用 Mercurial 进行版本控制。我愿意使用构建系统,尽管我对它们中的任何一个几乎都不熟悉。

本质上,我希望了解

  • 项目应存储在存储库中的位置
  • ,Eclipse 应如何导入或以其他方式发现项目,
  • 如何启动上述发现

*在这种情况下,新机器意味着具有必要应用程序的机器(例如Eclipse 和 TortoiseHg),但无需签出代码或任何工作区

I would like some advice on setting up a multi-project workspace using Eclipse. In other words, I intend to create some application which will use two or more projects for its final build. The projects will be stored in some version control system. This is pretty easy to do.

The advice I am seeking is how I should set up the version control or Eclipse workspace to make setting up a new developer/new machine* very simple. Ideally, that new developer or developer on a new machine would simply issue one command (to something: it could be Eclipse, the version control system, some build system, or even a script); that command will set up an environment from which it would be possible to build the code.

I will use Java for a language and Mercurial for version control, if that matters for a solution. I am open to using a build system, although I have no almost no familiarity with any of them.

Essentially, I am to hoping to learn

  • where the projects should be stored in the repository
  • how Eclipse should import or otherwise discover the projects
  • how to initiate the discovery mentioned above

*In this case, a new machine means a machine with necessary applications (such as Eclipse and TortoiseHg) but without checkouts of the code or any workspaces

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一场春暖 2024-10-23 16:04:24

每个 Eclipse 安装都需要安装 MercurialEclipse 插件,可以通过“安装新软件...”将其指向以下 URL 进行安装: http://cbes.javaforge.com/update

这些是我在设置新应用程序时通常使用的步骤:

  1. 在 Eclipse 中设置我的项目
  2. 转到命令行,创建一个 hg 存储库,然后将我的项目移动到包含存储库的文件夹中。
  3. 删除 bin 目录(这样它们就不会签入 Mercurial)
  4. 在 Mercurial 存储库的根目录中发出“hg add”。
  5. 在 Eclipse 中删除您的项目(不要单击“删除磁盘上的项目内容”复选框,否则您将收到错误消息)
  6. 在“文件”菜单中选择“导入”。选择“常规”文件夹下的“将现有项目放入工作区”。
  7. 选择“选择根目录”旁边的“浏览...”按钮,然后选择您的 Mercurial 存储库根文件夹。
  8. 在导入对话框中单击“全选”,然后单击“完成”。
  9. 打开导航器视图(这样您就可以看到 bin 文件夹),右键单击一个项目中的 bin 目录,转到“团队”和“忽略...”。选择“仅此文件夹('bin')”并单击“确定”。
  10. 选择所有项目,右键单击,选择“团队”并选择“提交”

此时,您的工作区已完全连接到本地 Mercurial 存储库,并且所有文件夹结构均已正确设置。

当您准备好与其他人共享时,您可以将存储库推送到共享位置。在另一个 Eclipse 环境中(可能在另一台计算机上)转到“Window”菜单并选择“Show View”和“Other...”。在 Mercurial 文件夹中选择“Mercurial Repositories”,然后单击“确定”。在刚刚出现的 Mercurial Repositories 视图中,单击“Create Repository...”按钮。它看起来像一个团队存储库,上面有 HG 和一个加号。输入您的共享存储库 URL 和任何身份验证信息(如果需要)。右键单击刚刚创建的存储库,然后单击“克隆存储库”。就是这样。所有 Eclipse 设置都是从​​ Mercurial 中提取的,并且一切都是为第二个开发人员设置的。

这听起来可能有很多步骤,但由于我已经练习了几次,所以我可以在不到两分钟的时间内完成此操作。

Each Eclipse installation will need to install the MercurialEclipse plugin which can be installed through 'Install New Software...' by pointing it at the following URL: http://cbes.javaforge.com/update

Theses are the steps I usually use when setting up a new application:

  1. Setup my projects in Eclipse
  2. Go to the command line, create an hg repository and then move my projects into the folder that contains the repository.
  3. Delete the bin directories (so they don't get checked into Mercurial)
  4. Issue the 'hg add' at the root of your Mercurial repository.
  5. In Eclipse delete your projects (don't click the 'Delete project contents on disk' checkbox or you will get an error)
  6. In the File menu choose import. Select 'Existing Projects into Workspace' under the General folder.
  7. Select the 'Browse...' button next to 'Select root directory' and select your mercurial repository root folder.
  8. Click Select All in the import dialog and then click Finish.
  9. Open up the navigator view (so you can see bin folders), right click on the bin directory in one project, go to 'Team' and 'Ignore...'. Select 'Only this folder ('bin')' and click OK.
  10. Select all of the projects, right click, select 'Team' and choose 'Commit'

At this point your workspace is completely connected to a local Mercurial repository and all your folder structures are set up correctly.

When you are ready to share this with someone else you push your repository to a shared location. In another Eclipse environment (probably on another computer) Go to the 'Window' menu and select 'Show View' and 'Other...'. In the Mercurial folder select 'Mercurial Repositories' and click 'OK'. In the Mercurial Repositories view which just showed up click the 'Create Repository...' button. It looks like a team repository with the words HG and a plus sign. Put in your shared repository URL and any authentication information if needed. Right click on the repository just created and click 'Clone Repository'. That is it. All of the Eclipse setup is pulled from Mercurial and everything is set up for the second developer.

This may sound like a lot of steps but I am able to do this in less than two minutes now that I have practiced doing it a few times.

心凉怎暖 2024-10-23 16:04:24

我建议使用 Maven 作为您的构建系统:

  • 与 Eclipse 集成良好
  • 独立于 Eclipse 的
  • 可脚本化/可以从持续集成服务器调用 在

某个地方创建一个“main-golden”mercurial 存储库,并直接在根级别添加多模块 POM。然后,开发人员可以克隆此存储库并在根级别调用“mvn clean install”来构建所有内容。

为每个子项目创建一个子文件夹。您可以根据需要将它们嵌套得有多深。

I recommend to use Maven as your build system:

  • integrates well with Eclipse
  • Eclipse-independent
  • scriptable/ can be invoked from a continuous integration server

Create somewhere a "main-golden" mercurial repository and add the multi-module POM directly at the root level. Developers then can clone this repository and call "mvn clean install" at the root level to build everything.

Create a subfolder for every subproject. You can nest them as deep as you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文