Douglas has posted 1 posts at DZone. View Full User Profile

Why I Like Using Gradle in NetBeans IDE (Part 2)

11.05.2012
| 10754 views |
  • submit to reddit

Part 1 of the NetBeans/Gradle series came from Martin Steffen in Uruguay. Below, in part 2, we travel to Scotland!


 

My name is Douglas Maxwell. I’m Scottish and  a Java software consultant specializing in financial apps. 

I’ve been using Groovy for over a year now and that is what led me to start experimenting with Gradle. I enjoy the terseness and expressiveness of the Groovy language, which I am able to exploit for build management with Gradle, no more XML verbosity and the ability to exploit Ivy’s excellent dependency management.

I manage my own software codebase in Subversion. I develop using agile methods which means lots of unit and integration tests. The codebase is managed with Gradle and the CI jobs are executed on a Jenkins server. I prefer to develop in NetBeans IDE using Gradle to manage my projects primarily because of the excellent support for dependency management and the ease of use when configuring multi-project builds.

What follows is a short description of a basic server side module for trade capture and my typical development workflow:

  1. Go to Tools | Plugins in NetBeans IDE 7.2 and install the Gradle plugin. Then open or create a Gradle Java project in NetBeans IDE, using the Open Project dialog or New Project dialog to do so.
  2. Write code and configure dependencies in the Gradle "build" file:



    This project consists of some service and DAO classes.  It uses Spring JavaConfig and JPA to manage persistence. The database is sql server 2012 in spite of the fact that I am a big fan of Oracle 11g. There is a single integration test which runs a Groovy script to set up the database schema and inject the initial test data. Here is the build file.



    As you can see it uses artifacts from a local Ivy repository. The output from the build is deployed to the same repository.
  3. I run all the test locally:





  4. The changes are then committed to the Subversion repository. Currently I do this external to NetBeans IDE, though I think this can be done from the IDE with the latest version of the plugin.


  5. As this project is not part of my main build, I have setup a separate gradle job in Jenkins,  which runs when changes are detected in the Subversion repository.




Conclusion

I am very impressed with the NetBeans plugin for Gradle so far. Rarely do I have to step out of NetBeans IDE and run a part of the build from the Gradle command line. I would, however, like to see some of these features added:
  1. the ability to add command line switches when a task is executed
  2. the ability to navigate test results in the Projects window
  3. the ability to add Groovy sources
  4. the ability to create different types of Gradle projects with the appropriate plugins and dependencies added automatically
  5. the ability to have a project update automatically when changes are applied to the build file.

The last feature might be implemented but it just doesn’t seem to work for me!

Published at DZone with permission of its author, Douglas Maxwell.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Attila Kelemen replied on Tue, 2012/11/06 - 5:49pm

Thank you for the article. I would like to respond to the request:

  1. I'm not exactly sure what you mean but 1.1.7 will support customization of built-in tasks. I believe this should solve most issues.
  2. Do you mean like it is done for Maven or Ant projects?
  3. If the plugin does not list a folder which exists and is configured in the build, then it is not supplied by the Tooling API of Gradle (assuming no bugs). You have to configure the "idea" plugin within the build script, so that the plugin can see the source root.
  4. I don't know what project type you mean but I'm not planning to add more specialized project types (since they are somewhat tedious to add with questionable value). However, sometime in the future I plan to add somekind of project type which is customizable by the user. However, I have not yet determined the exact way it will be done.
  5. The project is never reloaded automatically because it may take quite a bit of time for large projects and you don't always need to reload a project just because you edited the build script (i.e., you need to reload to see the newly added dependencies and source roots, otherwise it is not necessary). Also, editing the build file does not cover all cases when a project needs to be reloaded and in general, it is not possible to determine when the project needs to be reloaded. Perhaps in the future I will consider adding automatic reloading as an optional (opt-in) feature.

Matt Coleman replied on Wed, 2013/02/06 - 12:58am in response to: Attila Kelemen

a valid point Attila!

sell sheet design 

Bryan Low replied on Thu, 2013/03/07 - 10:15pm

I have always believed that investments in Hillview Peak condo and condominiums is always a better choice than any other forms of investment. Not only can the investor leverage on his investment, he can always stay in the unit should he decide not to rent out the unit. Investing in stocks, gold etc has really no tangible benefits on your investment. Thats just my 2 cents thought though. Thank you author for the informative writeup.

Hillview Peak

Morkel Abie replied on Fri, 2013/04/12 - 6:16am

This blog is always wonderful..the insights are too brilliant and useful .Thanks for this good site. bigger erection

John Brown replied on Wed, 2013/07/24 - 1:01am

 This plug in is wonderful, I'm using it for years, very useful and easy to use with me.

Oud oil

Loris Smith replied on Mon, 2013/09/16 - 4:20am

 

ecigaret
You probably don't agree with all of the various rules and criteria I’ve described. Some of the traditions, especially those that take names out of parents’ hands, may seem utterly foreign. Yet I’ll bet you can understand and even appreciate most of the impulses behind the different approaches. Iceland, for instance, is trying to preserve its national heritage and protect children from ridicule. And what could be more natural for Tibetan Buddhist parents than asking the Dalai Lama to choose the right name for their child?

Debra Santos replied on Wed, 2013/09/18 - 3:34am

i think that Gradle plugin is a must! Sean @ Home Aquariums

Loris Smith replied on Thu, 2013/09/19 - 3:01am

Exhibition Stall Designer Mumbai

  You probably don't agree with all of the various rules and criteria I’ve described. Some of the traditions, especially those that take names out of parents’ hands, may seem utterly foreign

Loris Smith replied on Thu, 2013/09/19 - 4:52am

 

order slim 24 pro

This plug in is wonderful, I'm using it for years, very useful and easy to use with me.



Loris Smith replied on Tue, 2013/09/24 - 6:17am in response to: Matt Coleman

 slim 24 pro 

I am very happy to be here because this is a very good site that provides lots of information about the topics covered in depth. I am glad to see that people are actually writing about this issue in such a smart way, showing us all different sides to it. Please keep it up. I cant wait to read whats next.

Asian Mart replied on Thu, 2013/10/10 - 4:31pm

thx for the great info....i appplied in practical and it works....i have visited many websites that provide info on plugin and all but not every info is managable  for norma user but i m happy you have explaned it in a good way...keep it up

http://www.slim24pro-weightloss.in

Asian Mart replied on Wed, 2013/10/16 - 4:08pm

thx your for the info.....love reading blogs here

http://www.slim24pro-weightloss.in

Asian Mart replied on Thu, 2013/10/31 - 4:12pm

slim24pro great way to explain the complete article.specially the pictures are very good zero addiction

Asian Mart replied on Thu, 2013/10/31 - 4:14pm in response to: Loris Smith

<a href="http://www.slim24pro-weightloss.in">slim 24 pro</a>

Asian Mart replied on Thu, 2013/10/31 - 4:16pm

air sofa good work...and the proxy you showed are relly helpful pelase update more articles with pictures and settings

Asian Mart replied on Thu, 2013/10/31 - 4:20pm

fair look no addiction


explanation is really good and if we need to know more how can we contact and ask for details

Asian Mart replied on Thu, 2013/10/31 - 4:24pm

no addiction hx for the great info....i appplied in practical and it works....i have visited many websites that provide info on plugin and all but not every info is managable  for norma user but i m happy you have explaned it in a good way...keep it up

Peter John replied on Tue, 2013/11/26 - 2:26am

 A wonderful and unique lifestyle awaits you. Please see Sembawang EC project details and floor plans for more information.

Electronic Cigarette

Abbey Zabby replied on Tue, 2013/12/10 - 9:54pm

 

You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd love to write some material for your blog in exchange for a link back to mine. Please shoot me an email if interested. Thank you!
Maurice villas

Abbey Zabby replied on Wed, 2013/12/04 - 3:31am

 

Another great example of innovation, I am glad to locate it. There are so several developers working on this segment but this is one of the best innovative idea ever. Thanks for sharing it here.
Epic fail

Abbey Zabby replied on Sat, 2013/12/14 - 2:04am

 

Great weblog here! Also your site quite a bit up fast! What web host are you the usage of? Can I get your associate link on your host? I want my site loaded up as quickly as yours lol
flac to mp3

Abbey Zabby replied on Mon, 2013/12/16 - 5:18am

 

A good point Ralph, but I believe people are going to have a hard time defending prejudice when the possibility of answering certain kinds of questions with much greater precision increases.
free cool games

Abbey Zabby replied on Fri, 2013/12/20 - 1:15am

 

Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here.
buy youtube views cheap

Abbey Zabby replied on Tue, 2013/12/31 - 5:11pm

seems to stipulate or is this just a statistical artifact within an aggregated narrative about women that's even harder to swallow
brands of garcinia cambogia

Abbey Zabby replied on Fri, 2014/01/03 - 6:32am

 

I enjoy alot reading your post so, i have made these comment here hope you will like it
true tech news blog
.

Abbey Zabby replied on Sat, 2014/01/18 - 12:58pm in response to: Loris Smith

I really do appreciate this so much. This was a very good and interesting article to say the least. Thanks! I work for a design company and I have really learned so much from this great site. how to make sauerkraut

Abbey Zabby replied on Sat, 2014/01/18 - 6:33pm

You could post on the friendless of the blog owner. You may illustrate it's mesmerizing. Your blog feedback may add to your contacts.
blog post

 

Atif Aslam replied on Sun, 2014/01/19 - 4:50pm

 A package can include any content or project-related data from your repository.
Best Android Apps And Games 2014

Desmond Riverba... replied on Wed, 2014/01/22 - 11:37am

You need to find the right painkillers for your pets, which is not very difficult to find. Keep in mind of the fact that you should not mix a pet medication and a person would intake. The wrong mixture or dosage might seriously injure your pet and might be fatal sometimes. Never try this to your pet. dog medication

Abbey Zabby replied on Mon, 2014/03/03 - 8:45am

We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work.
http://topinversiontablereviews.com

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.