Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

MuleSoft: Encouraging Teamwork to Enhance Productivity

DZone's Guide to

MuleSoft: Encouraging Teamwork to Enhance Productivity

This article will explain how to install the EGit plugin for Anypoint Studio and use it during project development.

· Integration Zone
Free Resource

Share, secure, distribute, control, and monetize your APIs with the platform built with performance, time-to-value, and growth in mind. Free 90-day trial of 3Scale by Red Hat

For a simple integration project, a developer can configure the project on its own machine and then deploy it to server once it is finished. However, like other software development activities, integration projects may be not as simple as that. It can be complicated and requires collaboration from many developers. They might be working with the same resources, which probably leads to confusion or conflict.

Actually, there is no doubt that every developer is aware of this issue. And obviously, they will implement version control. So everyone can work together focusing on their own task and then merge the changes to the same resources. There are many options to do this. One of popular version control system is Git. an open-source version control system that is widely used for software development.

The thing is: Anypoint Studio does not have Git support out of the box!

Therefore, to enable our team members to work together using Git in Anypoint Studio, we have to install an EGit plugin. This article will explain how to install the EGit plugin for Anypoint Studio and use it during project development.

EGit Plugin for Anypoint Studio

  1. Open Anypoint Studio and go to Help >> Install New Software…
  2. Click the Add… button, and then enter the following information:
  3. Name = EGit Install Site
    Location = http://download.eclipse.org/egit/updates

    Image title

  4. If you have any problem with the URL, then download it first from http://www.eclipse.org/egit/download/ to a local folder and change the Location above with the downloaded file address.
  5. After clicking the OK button, then the value of “Work with…” will be updated. Eventually the relevant plugins available from the URL which we just entered will be showed.
  6. Click Select All button.
  7. Expand the first plugin: Eclipse Git Team Provider.
  8. Uncheck/deselect the “Eclipse Git Team Provider - Task focused interface” option.
  9. Image title

  10. Click the Next button. Eclipse then shall check the URL and the requirements needed for installation.
  11. Then just follow the installation instruction, e.g.: click Next button.
  12. Click “I accept the terms…” on the license agreement.
  13. Click the Finish button. Then Eclipse will install the plugin.

Upon completing the installation, Anypoint Studio will require a restart. After that add another perspective by the following steps:

  1. Go to Window >> Perspective >> Open Perspective >> Other…
  2. Or click Open Perspective button on the top of right Anypoint Studio.
  3. Image title

  4. Select Git and then click OK button.
  5. A perspective button will appear:
  6. Image title

  7. By clicking it we will be able to manage Git repository within Anypoint Studio.
  8. Image title

Setup Git Project

There are several ways to setup Git project, such as Import or Clone a Git repository. Both of them are accommodated by Anypoint Studio. In this article, we use the first option (use Import). Later we will see its association with Git Repositories perspective above:

  1. File >> Import
  2. Inside the Import window expand Git.
  3. Select Project from Git, and click Next button to move to the next step.
  4. Select Clone URI.
  5. Fill all required fields, or just put the correct URI then other fields will be automatically populated.
  6. Select the preferred Branches.
  7. Set the Destination Directory.
  8. Select the wizard to import the project: Import using the New Project wizard.

After the Finish button is clicked, a new window will be displayed. Now we have to configure the new project which will be imported:

  1. Expand Mule, select Mule Project, and then click Next button to move to the next step.
  2. Fill the Project Name.
  3. Uncheck/deselect Use default location option.
  4. Fill the Location (type it directly or click Browse button) with the value of Destination Directory (step #7 above).
  5. Click Finish button.

A new Mule project will be imported and displayed in Package Explorer. Also the new Git repository will be listed in Git Repositories perspective. The same result when we choose the second option: Clone a Git Repository.

Image title

By installing EGit plugin, we can easily execute any Git actions. The suggested actions will be provided based on the selected resources: project, folder, or file. Right click and choose Team menu on resources, alternately to see the different options.

Image title

Switch Branch

For some reason a project might be consist of some branches. To switch from one branch to another one: right click on the project name, choose Team >> Switch To… >> and select the branch name. In case there are too many branches then select Team >> Switch To… >> Other …

Manage the Changes

Any file modification will be tracked and marked. There are three common marks that are used to notify developers when they modify the code. Each mark represents different meaning:

  • ? = represent an untracked file, which is not under Git version control yet
  • + = new file
  • > = modified file

To follow up those changes there are many Git actions that can be chosen, such as: fetch, pull, commit, or push. These actions are also provided after right click >> Team.

Compare the Contents

To make sure that current modification fits the requirement and it does not break current implementation, we can compare with its original one. For another purpose, we might need to compare our recent changes among last commit, the index, or the current working tree. To confirm it, select the resources and right click >> Compare With.

Image title

Rather than evaluate the contents, we also able to see each resource’s changes history. A comments or notes of modification which recorded every time it is committed. The History View can be displayed by right click >> Team >> Show in History.

Image title

Revert the Changes

Due to some circumstances we need to revert back to a previous version. Instead of rewriting the latest code, we can easily go back to the previous one. Still similar as other actions, select the resources and right click >> Replace With: Head, Index, Previous Revision, etc.

That is few examples on how to use EGit plugin in Anypoint Studio. Please feel free to explore other features and other Git action options.

Credits:

Gama Ogi Prayogo for his guidance via internal company blog: How to install EGit plugin

Explore the core elements of owning an API strategy and best practices for effective API programs. Download the API Owner's Manual, brought to you by 3Scale by Red Hat

Topics:
mulesoft studio ,mulesoft ,egit

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}