Creating your group repository

This guide will explain how to setup your group repository for use in TDT4250's exercise project.

A default project with the necessary files (gr16nn) has already been provided on Stash, but every group needs to download it and copy the content over to their personal Stash repository.
In addition to copying the default project files everyone needs to rename certain files in the default project. 

Note: The initial setup of the groups repository only need to be done once by one of the group members. The rest of the group can download the groups repository to eclipse once the setup is done.

Clone the default project from Stash

Get the clone URI from Stash:

Go to:
https://git.it.ntnu.no/projects/TDT4250 

Go into the "gr16nn" repository, press the Actions button and select the "Clone" action. Then copy the URI inside the HTTP window.
(NOTE: You need to copy the URI yourself as its connected to your user!)

 

Import the default project into Eclipse


From Eclipse choose File -> Import, then select the Git folder and choose "Project from Git". Select "Clone URI" and press next. Afterwards you paste the URI into the URI field,
fill inn your username and password for Stash and press next (If username is not filled in you will be prompted with a Login popup). 

Keep pressing "next" until you get to the import project screen and is able to press "finish". No need to change the default settings (You can however change default location if you wish). 

Importing your group project to eclipse git repositories (The first time)

After downloading the default project from Stash you want to copy it over to your groups repository. There is many ways of doing this, but we will show you how to do this inside eclipse.

First you need to activate a separate window for the Git repositories connected to eclipse  (as your repository does not contain an Eclipse project yet so you cant import it as an eclipse project). To do this go to Window -> Show View -> Other.. Then open the "Git" folder and choose "Git Repositories".

 

This will open a new window with Git Repositories connected to eclipse. You want to add your groups repository to this list. To add your groups repository to this list you need to press the "Clone a Git repository and add the clone to this view" button (the one with the small blue arrow show on the below picture.

In the import window fill in the URI for your group repository and press next until you can press finish. Your group repository (For group 0 its gr1600) will now be displayed in the Git Repositories.

 Copying the default tdt4250.gr16nn repository into your groups repository

 Now comes the part where you must copy the current tdt4250.gr16nn project into your own repository (which is still not an eclipse project).

First you right click the tdt4250.gr16nn project in eclipse and press "copy", then "paste" into the project explorer (Or simply press Ctrl+C then Ctrl+V). In the Copy Project popup you need to change the project name and un-check the "use default location". The new project name should be the "tdt4250.gr16 + your group number" so if you are group number 1 it should be "tdt4250.gr1601".

The Location field: You need to find your group's repository (which you imported into the Git Repositories earlier), it should be located where you saved it ( either in your local work space or in your git folder). Then you need to add the suffix "\tdt4250.gr16 + your group number" (see picture below where group 0 is used).

You should now have your groups repository displayed in the project explorer in eclipse.

Renaming your groups project in Eclipse

Now you have your groups repository in eclipse, but you still need to change all the names into your groups specific number.
This means changing the "nn" in tdt4250.gr16nn" into your groups personal number (e.g "tdt4250.gr1601" for group 1).

Note: Renaming is an important and somewhat fragile process, if only one renaming is forgotten the build itself might not work at all.

1. Rename folders

First rename the tdt4250.gr16nn.model folder.

Then delete the tdt4250.gr16nn project (Shown in the picture below) from eclipse (Do NOT check "delete content from disk").

Afterwards you right click the "tdt4250gr16 + your number" project and select the import option. Then select the "General" folder and choose "Existing Projects into workspace". Select your projects destination folder as root directory and make sure the "Search for nested projects" is checked. Then select the "tdt4250.gr16 + your number".model folder from the list and press finish. The model folder will now be seen as an eclipse project from eclipse.

 

Now you need to rename the .model folder again, so rename the .model folder so it gets the group number instead of "nn".

After you renamed the folder you need to delete the content of the "src" folder, simply select everything inside the src folder (not the src folder itself) and delete it.

Now we need to rename and edit all the build specific files, pom.xml, MANIFEST.MF and afterwards the ecore model itself.

There are two pom.xml files.

The parent pom.xml: rename the "nn" in the GroupId and ArifactId, and also remove the current module in "Modules" named "tdt4250.gr16nn.model". You can also change the project name as shown below (using your groups number).

After renaming and deleting the modules content you need to import the correct module. To import the module press "Add.." then select the tdt4250gr16 + your group name project" as shown below and press "ok".

 

Now you are done with the parent pom.xml. Next is the pom.xml in the .model folder. Here you need to rename the ArtifactId for both Artifact and Parent, and also the GroupId for Parent.

 

After renaming both pom.xml files you need to rename the MAINFEST.MF, Here you need to rename the ID, the Name and clear the Vendor field if its not empty.

 

After renaming all the build files you need to rename the Ecore model. First you rename the model file itself (shown below).

 

Secondly you need to rename the model. By double clicking the model and selecting it then change Name and Ns Prefix into "gr16 + your number" and in the Ns URI you change the "nn" numbers to your group number.

Remaking the genmodel file

After renaming everything you should now create the "genmodel" file. This is done by right clicking the project folder and selecting new -> other.

 

Then you click on the"Eclipse Modeling Framework" folder and select EMF Generator Model.

Now you have to select the parent folder for the genmodel, this should be the "model" folder where the ecore model is located.
The name of the genmodel should be gr16 + "your groups number".genmodel as show on the image below.

After pressing next you choose "Ecore model" and then next, select Browse Workspace and find your ecore model "gr16 + your model number.ecore" and press ok.

Now you have a genmodel. The genmodel need to have a base package name, so double click the genmodel and add "tdt4250" as base package name (scroll all the way up).

 

Test project with maven and generate model code

Now you got a complete project on your drive, to test that the project is working as intended you can run "mvn clean install" and get Success.

You can also generate the model code by right clicking the .genmodel and selecting Generate Model Code. Now the generated code should show up in the "src" folder. 

Now you are Done (big grin) (with this guide, now you can start working on your group project)

  • No labels