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.
Are you a Developer working with PDF files?
Our developers guide contains a large number of technical posts to help you understand the PDF file Format.
Do you need to solve any of these problems?
Display PDF documents in a Web app |
Use PDF Forms in a web browser |
Convert PDF Documents to an image |
Work with PDF Documents in Java |
Just curious, why switch from mercurial to git?
In my experience, mercurial offers the same features but is easier to use.
Cheers,
Timon
Hi Timon,
We originally started using mercurial because it was the only version control that kiln supported. Git essentially does the same things as mercurial although e found that it had a better auto pull for or projects and we can easily upload to github. Another reason for switching was that with the way that the market is going we wanted to keep our skill set up-to-date. I hope this helps 🙂
Thanks Sophia,
Switch from subversion to mercurial had a clear benefit back then, at the moment I see no game changing feature that justifies the effort in switching to git, so I’ll stick with mercurial for now 🙂