Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Finish instructions

...

  1. Create a folder for the Eclipse project in your folder of Eclipse workspaces. The name of this folder should be example. That is:
    1. eclipse-workspaces/example
  2. Create a second folder under the example folder you just created. This second folder is going to contain the source code for your project and is a temporary folder to be manipulated by later steps. You will also call this folder example. That is, you will now have:
    1. eclipse-workspaces/example/example
  3. Copy the maven project “src” directory tree and the pom.xml file to the source code folder. That is:
    1. eclipse-workspaces/example/example
  4. Start Eclipse. When it completes startup, there should be no projects visible; your workspace is empty.
  5. In the workspace launcher dialog, select the Eclipse project working directory you created in step 1:
    1. eclipse-workspaces/example
  6. If Eclipse asks, don't send usage data to the Subclipse team.
  7. File > Import...
  8. In the Import wizard Select step, expand the Maven folder, select “Existing Maven Projects”, and click Next.
  9. In the Import Maven Projects wizard Select Maven Projects step, click Browse... next to the Root Directory text box.
  10. In the Select Root Folder dialog, select the source code folder created in step 2 and click OK
    1. eclipse-workspaces/example/example
  11. Click Finish.
  12. Right click on the “example” project in the Eclipse Project Explorer and Select Maven > Update project from the popup menu.
  13. In the Update Maven Project dialog, select the “example” project and click OK.
    1. At this point, you have updated the Maven dependencies in your project. You have done nothing to synchronize with Git.
  14. Add a .gitignore file to the source code folder (eclipse-workspaces/example/example). This file will be in the same folder/at the same level as the pom.xml file. See below for example. (Note: If you want to see the .gitignore and other hidden files in your Project Explorer, select the Project Explorer View Menu (triangle pointing down, select Customize view... from the popup menu, and uncheck the “.*resources” filter.)
  15. You are now going to create a Git repository. Right click on the “example” project in the Eclipse Project Explorer and Select Team > Share Project... from the popup menu.
  16. In the Share Project wizard Share Project step, select the Git repository type and click Next>. (Note: If you don't have any other repository plugins, this step will be skipped. If you don't see the Git plugin, you probably haven't installed Egit.)
  17. In the Configure Git Repository step, click Create... next to the Repository dropdown.
  18. A popup appears with two fields to complete. Browse to the folder when you maintain your Git repositories (e.g., git-repositories). For the name element, enter the name for this repository. By our convention, you will use the name "example". Click Finish.
  19. You are returned to a popup for creating the repository. Click Finish. This creates your local Git repository, and moves your project to it, but it does not mark anything for version control. You will notice “?” badges on your tree entries in the Project Explorer.
    1. If you use a file browser or finder, you will find that the source folder under your Eclipse workspace has been moved to the Git repository folder.
  20. For  each directory or file you want to have under version control, right click on that file in the Project Explorer and select Team > Add to Index from the popup menu. This will definitely include the src directory tree, .gitignore and pom.xml. If your .gitignore is set up reasonably, the other directories will not have the “?” badges. When you do this, the “?” badge will change to a “+” badge, indicated that the file is to be committed.
  21. Right  click on the “example” project in the Eclipse Project Explorer and Select Team > Commit... from the popup menu.
  22. Right  the Commit Changes to Git Repository dialog, enter an appropriate commit message (e.g., Initial commit, moving to imphub next.) You can verify that the files you want are being uploaded in the Files panel. Click Commit. The “+” badges will change “drum” badges, indicating that the repository is up to date with the project.
    1. Do not "Commit + Push". You are only committing your files locally with this step.
  23. Log into imphub Stash at https://code.imphub.org/projects. (Stash is the name of the application in the Atlassian suite of products that provides the code repository). 
  24. From the Stash Projects screen, select the project that will be the parent for your new repository. For IHE software, the parent project is IHE Test & Management Tools.
  25. From the Stash screen for your project, click on Create Repository.
  26. On the Create Repository screen, enter the name for your project's repository (e.g. example). Because this is a new (empty) repository, the You have an empty repository screen will appear. This screen will have sample command line entries.
  27. Open a terminal on your computer and move to the repository directory for your project. (Note: This directory will have the project directory in it. If you see the src directory and the pom.xml, back up one level.)
  28. At the command line, enter the git command to make the imphub repository the “origin” for this repository. If the repository is a new one (i.e., just added using the steps above, there will be no existing origin repository and the command would be (use your own imphub account, not moultonr):
    1. git remote add origin https://moultonr@code.imphub.org/scm/ihe/example.git
  29. If the repository is a pre-existing one which was previously pushed somewhere else, then the origin needs to be changed and the command would be (use your own imphub account, not moultonr):

    1. git remote set-url origin https://moultonr@code.imphub.org/scm/ihe/example.git
  30. Now push the project to imphub. You should be asked for your password. Use the command below at the command line:x
    1. git push origin master
  31. You can now browse to the code in the imphub repository and see the files you have pushed.

 

Sample .gitnore file (straight text)

# ignore all bin & target directories

bin/

target/

# ignore dirty editor temp files

*.snapshot

# ignore Eclipse file generated from Maven

.settings/

.project

.classpath

 

# ignore all files ending with ~

*~