Why I Like Using Gradle in NetBeans IDE (Part 1)
Greetings from Montevideo, Uruguay! My name is Martin Steffen and I use NetBeans IDE in my work as a developer. Also, I use NetBeans IDE in my career as a student. I use NetBeans IDE for all my projects and always have installed the latest NetBeans IDE version (waiting for the new support of HTML5 :) in NetBeans IDE 7.3).
In general, I love to research new technologies and now Gradle is my point of interest. Currently I am developing a web application with Gradle, while using the Gradle Jetty plugin, (https://github.com/martins1930/atfsff/tree/master/Atfsff), and the build.gradle is the following: https://github.com/martins1930/atfsff/blob/master/Atfsff/build.gradle.
The NetBeans Gradle plugin has everything needed to develop this project:
http://plugins.netbeans.org/plugin/44510/gradle-support
To develop the project with Gradle and NetBeans IDE, I follow the steps below:
- Open the NetBeans Terminal window (Window | Output | Terminal) and run
"gradle jettyRun", as you can see here:

- Right-click the project node in the Projects window and choose "build", as you can
see here:

- Go to your browser and see your running application!
- End of development cycle. :)
When I modify JSP pages, and static resources
(HTML/JS/CSS), I don't need to rebuild the project because you
see the changes in the browser
instantly. When I modify a Java class, I only need to
re-build the project (but don't need to stop Jetty), that is, when building the project
Jetty automatically redeploys the app for you.
Interesting features:
- static resources (HTML/JS/CSS) are refreshed instantly, as stated above, which makes me feel productive
- redeploying in Jetty when building the project
- the project dependencies are shows in the Projects window
Features I would like the plugin to have:
- Open the browser
when running a project; if it is not
very difficult to implement this would
be good to have.
- Enable version control
when right-clicking a project. The version control is disabled for Gradle
projects as you can see in the second image above, while for Ant projects it is enabled, as you can see below:

- Automatically build a project on saving. In Ant projects, you can check the option
"Compile on Save" as you can see below:

- Glassfish embedded tasks (similar to the Jetty tasks http://gradle.org/docs/current/userguide/jetty_plugin.html), for developing full JavaEE applications, though this feature is more for the Gradle team, perhaps.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)





Comments
Hans Dockter replied on Thu, 2012/10/25 - 5:32am
Attila Kelemen replied on Thu, 2012/10/25 - 8:20am
Thank you for the article. It is nice to see that the Gradle plugin is being used for something that it was not explicitly planned for. Anyway, I would like to answer to the wishes related to the Gradle plugin:
Douglas Maxwell replied on Tue, 2012/11/06 - 10:58am
This is probably not the right place for this question .
Anyway .
Is NbGradleProjectFactory threadsafe?
What happens around lines 33,34 when a CounterCloser decrements the count to zero (line 137) and decides to remove the counter from the map but hasn't actual removed it before the current thread increments the count and checks the map for the existence of the soon to be removed counter?
Attila Kelemen replied on Thu, 2012/11/08 - 3:27pm
in response to:
Douglas Maxwell
Thank you for the catch. The code is not thread-safe. Although it cannot cause a bug because currently this method and the close() are never called concurrently (they are always from NbGradleProject.PROJECT_PROCESSOR which is single threaded). Anyway, this should be fixed.
Next time please file an issue instead because I might not notice here.
Anyway, if you are wondering why I didn't use a simple lock instead: No real reason, just for fun. I like to play with concurrency and I thought there is not much to lose if I screw it here (as I sadly did). Obviously, I should have been more careful.
Douglas Maxwell replied on Thu, 2012/11/08 - 4:39pm
in response to:
Attila Kelemen
Hi Attila
It was just something that caught my eye that is all.
I'll be sure to file an issue the next time if I come across any bugs.
Cheers,
Doug.
Matt Coleman replied on Fri, 2013/01/18 - 1:35am
Gradles indeed is so useful...i use it if i can
buffalo freelance website designer