When changing from Mercurial to Git in the NetBeans IDE one of these changes is to change our Ant based projects to Maven based projects. For those of you who don’t know what Maven is then you can look at these articles to learn more: https://maven.apache.org/what-is-maven.html and https://en.wikipedia.org/wiki/Apache_Maven.
Previously my colleague Georgia has written an article on Converting Ant based NetBeans project to a Maven project and how we went about making the changes to our project in NetBeans. We have now fully transitioned across all of our projects at IDR Solutions.
In this article I am going to be demonstrating how we changed from using mercurial in NetBeans to using Git.
Step 1) Install the Git Plugin for NetBeans
To make your life easier NetBeans has a really simple and easy to use plugin for using Git as your version control.
To download the plugin you will need to go to:
Tools > Plugins
When you arrive there you will need to select the Available plugins tab and search for Git tool bar. Once found click download and install.
Step 2) Customize your new Git toolbar
Now that you have installed the plugin if you right click on out tool bar and press customize tool bar from the drop down list you will find that the Git tool bar options are there and ready to be selected.
Personally on my machine I prefer to keep what I feel is necessary on the tool bar, for instance i have the following on my toolbar:
Commit, Pull from upstream, Fetch from upstream, Push to upstream, diff to head,show changes, Revert modifications and show history.
From the dialog box which is open your able to drag things up-to the tool bar that you want to be there. When you have finished you just need to click close and those options will remain there for you to help you work more effectively.
Step 3) Global settings for Pushing and Pulling
This next step will help save you a lot of time.
First of all highlight all of the projects which you will be pushing and pulling from the repository. Then with them selected click team from the drop down choose repositories and open global configuration.
A file will then open, which you will need to append. Anything you set in here will be the default for all of your projects. In this case we are going to copy and paste the following into the file:
[user] name = *insert name* email = *insert email*
with that being done when you push and pull your projects it will use the information we have provided.
Step 4) Ignoring custom files and NOTHING ELSE
Because each developer has different configuration settings to run their projects in their individual ways, we need to make sure that were not overriding them each time a new user pushes there code. When we create our own configurations NetBeans creates its own local maven files.These are the only files that we need to make sure we ignore, as i mentioned earlier we don’t want anyone who has their own configurations to be lost each time we push to the repository.
You can do this by right clicking the file and going down to Git and then selecting ignore and then going back and doing the same thing but click exclude from commit.
Step 5) All Done
And your done, you should now have a fully working Git with maven repository and all of the shortcuts NetBeans offers to help you work more effectively..
What are you experiences like? Let us know.
Latest posts by Sophia Matarazzo (see all)
- Back to basics : What are PDF files and how much support is there for Java? - January 12, 2017
- Back to Basics: The 2017 Guide to to PDF Files introduction - January 11, 2017
- One month on: Our review of using Basecamp - October 11, 2016
- Key take away’s from Business of Software (BoS) 2016 – Day Two - September 22, 2016
- Key take aways from Business of Software (BoS) 2016 – Day One - September 20, 2016