一起使用Mercurial,Maven和Eclipse? [英] How to use Mercurial, Maven and Eclipse together?

查看:232
本文介绍了一起使用Mercurial,Maven和Eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为大学的5名同事组建一个Java项目。实际上,我们将在接下来的几天内完成规划阶段,然后开始实施。

I am currently working on a Java project within a team of 5 colleagues for university. Actually, we will finish the planning phase within the next few days and then start implementing.

对于这个项目,我们必须使用Mercurial(通过Bitbucket.org)和Apache Maven的。我们希望将Eclipse用作IDE。我知道如何使用Mercurial,我已经阅读了关于Maven的一些文章和指南。我不明白的是我们应该如何合作使用这些工具。

For the project, we have to use Mercurial (via Bitbucket.org) and Apache Maven. We'd like to use Eclipse as IDE. I know how to use Mercurial, and I've read some articles and guides about Maven. The thing I don't understand is how we should use those tools in collaboration.

应该在存储库中放置什么?整个Eclipse项目?还是只是源文件和Maven的pom.xml?如果后者,一个工作会话怎么样?拉入文件,用mvn eclipse:eclipse,eclipse代码创建一个Eclipse项目,并提交/推送它们到repo?

What should be placed on the repository? The whole Eclipse project? Or just the source files and Maven's pom.xml? If the latter, how would a working session look like? Pull the files, create an Eclipse project with mvn eclipse:eclipse, code a while and commit/push them to the repo?

我负责创建项目结构,所以我的同事和我也可以开始发展。但我真的不知道如何开始。如果使用Maven不是强制性的,那么我只需将Eclipse项目放到存储库中。但是不得不使用它,现在我很困惑,如果影响到一切。

I am responsible for creating the project structure, so my colleagues - and me too - can start developing. But I really don't know how to start now. If the use of Maven wasn't obligatory, I would just place the Eclipse project into the repository. But having to use it, I'm quite confused now how if affects everything.

推荐答案

我使用类似的设置,除了我我的存储库正在使用Dropbox(只有两个开发人员)。只需按照以下步骤操作: m2eclipse (更新站点: http://m2eclipse.sonatype.org/sites/m2e )和 MercurialEclipse (更新网站: http://cbes.javaforge.com/更新)插件,您可以在eclipse中执行所有操作。

I use a similar setup, except I am using Dropbox for my repository (just two developers). Just follow these steps, with the m2eclipse (update site: http://m2eclipse.sonatype.org/sites/m2e) and the MercurialEclipse (update site: http://cbes.javaforge.com/update) plugin you can do all in eclipse.

创建一个maven项目:

Create a maven project:


文件 - >新建 - >其他 - > Maven项目

File -> New -> Other -> Maven project

在Project Explorer中,右键单击新创建的maven项目

In Project explorer right click on the new created maven project


团队 - >共享项目... - > Mercurial - >(离开文件夹)完成

Team -> Share Project... -> Mercurial -> (leave the folder as it is) Finish

然后在项目根中创建一个.hgignore文件:

Then create an .hgignore file in the project root:

在Project Explorer中,右键单击新创建的maven项目

In Project explorer right click on the new created maven project


新建 - >文件 - >文件名:.hgignore和完成

New -> File -> File Name: .hgignore and Finish

.hgignore:

.hgignore:

syntax: regexp
target      # maven output
\.classpath # eclipse
\.project   # eclipse
\.settings  # eclipse
test-output # eclipse junit/testng plugin output

然后你可以做出你的第一个提交,但要注意的是,hg不会在它的存储库中存储空文件夹,所以为了保持maven文件夹结构没有源代码,你必须在每个空文件夹中放置一个(空)文件,一个简单的maven项目,没有任何来源,它将在文件夹中:

Then you can make your first commit, but beware, hg does not store empty folders in it's repository, so to keep the maven folder structure with no source code in it you have to put a (empty) file in each empty folder, for a simple maven project without any sources it would be in the folders:


  • myproject / src / main / java

  • myproject / src / main / resources

  • myproject / src / test / java

  • myproject / src / test / resources

  • myproject/src/main/java
  • myproject/src/main/resources
  • myproject/src/test/java
  • myproject/src/test/resources

例如,我将一个名称为.empty的文件放在其中,内容是这是一个占位符文件,如果其他文件在此夹

For example I put a file with the name .empty in it with the content "this is a placeholder file, remove if other files are in this folder"

如果某些文件夹丢失,如果同事们导入项目,同事会看到eclipse中的错误。

If some of this folders are missing your colleagues would see errors in eclipse if they import your project.

首次提交:

在Project Explorer中,右键单击新创建的maven项目

In Project explorer right click on the new created maven project


团队 - >提交... - >全部选择并输入提交消息 - >完成

Team -> Commit... -> Select all and enter a commit message -> Finish

现在可以将其克隆到bitbucket(我没有bitbucket的经验)。

Now you can clone it to bitbucket (I don't have experience with bitbucket).

告诉你的同事安装两个eclipse插件,然后他们可以通过

Tell your colleagues to install the two eclipse plugins and then they can get the repo via


文件 - >新建 - >其他 - >从SCM检出Maven项目 - >输入url到您的回购 - >完成

File -> New -> Other -> Check out Maven Project from SCM -> enter url to your repo -> Finish

然后你很好去。

这篇关于一起使用Mercurial,Maven和Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆