Showing posts with label Netbeans. Show all posts
Showing posts with label Netbeans. Show all posts

Thursday, February 26, 2009

NetBeans 6.7 M2 released with advanced Grails code completion



Last wednesday the NetBeans team released NetBeans 6.7 M2. For Grails developers this is great as it now supports code completion for dynamic methods and dynamic finders. Just great! And even better: debugging support is next on their priority list!



Check Petr Hejl's Blog for more information.

Saturday, January 31, 2009

Grails, NetBeans and Microsoft Team Foundation Server

At our internal development factory at Valid we use Microsoft Team Foundation Server (TFS) as the central versioning system. As we recently started a new Grails project we had to use TFS for versioning. We also use NetBeans 6.5 as it's has some nice Grails support.

When we started I had a little bit of caution against using TFS... And we faced some really annoying problem immediatly. You have to check out each file manually before you can edit it as the files are read-only. So for example when regenerating the controller and views for a domain class you have to check them out first... For Microsoft developers this is no problem as they are using Microsoft Visual Studio and the IDE is checking out the automatically when the change the file within their IDE.

For Eclipse users Teamprise ($$$) is available, but for NetBeans there is no plugin yet to work against TFS.

After searching for a solution I bumped at SvnBridge. SvnBridge allows you to use TortoiseSVN and other Subversion clients with Team Foundation Server. It converts the calls made by your Subversion client to the API supported by TFS. As NetBeans supports Subversion I gave it try, and my first experience is really good (just tried it out 30 minutes ago). I can connect with TFS as it was a Subversion server, and it automatically checks out the files when I edit them in NetBeans. Just great!

Here some steps to setup the SvnBridge:


  1. Download SvnBridge from http://www.codeplex.com/SvnBridge.

  2. Unpack the downloaded file and start SvnBridge.exe.

  3. A new icon will appear in your taskbar to indicate SvnBridge is running, you can right click it to change settings. I changed the Bridge Port to 8085 as my Grails application is running on the default 8080 port.




  4. In NetBeans go to Versioning -> Subversion -> Checkout as you would normally check out a Subversion project. You have to enter the bridged TFS/SVN path like: http://localhost:8085/[tfs.server.name]/[projectname] (e.g. http://localhost:8085/tfs.mycompany.com/myproject). Enter your TFS crendentials and you can check out your Grails project from TFS.






That's just it! You can now use NetBeans to enjoy working with a TFS versioning system. Don't forget all creadits go to SvnBridge.

Wednesday, November 19, 2008

Grails on NetBeans



Today NetBeans 6.5 was released. The Groovy and Grails support is really nice. I'm using it for a couple of months now since M1 and I'm really satified. If you haven't tried it and working on Grails projects you really should give NetBeans a go!

Can't wait though on better Groovy and Grails support in Eclipse. Let's see what SpringSource will bring us.

Wednesday, March 26, 2008

First experience with Groovy and Grails support in NetBeans 6.1



Recently many blog postings related to NetBeans with Groovy and Grails integration appeared on groovyblogs.org. See Guillaume Laforge's Groovy / Grails support in NetBeans and GlassFish blog entry for a complete summary and links to related postings.

When I was reading those posting I felt it was time to try it out myself.
After downloading the latest NetBeans 6.1 nightly build and installing the Groovy and Grails plugin, I was ready for a testdrive.

Creating a Grails project


Creating a Grails project has never been easier. The NetBeans 6.1 Groovy and Grails plugin contains a New Project wizard for creating a new Grails project.



After creating the project (NetBeans is calling the Grails create-app command underwater), NetBeans displays a nice project structure specially for Grails projects.



See how NetBeans nicely devides all Grails artifact types (like Controllers, Domain classes, Scripts, Services, etc.) in separate folders.

Creating Grails artifacts


The NetBeans 6.1 Groovy and Grails plugin features context menus for creating Grails artifacts like Domain classes etc easily. After clicking the context menu item, a dialog is opened to enter information needed to create the Grails artifact.





After creating the domain class a context menu is available for generating the controller and views.



NetBeans is always calling the Grails commands underwater and this means that when generating the Views from within NetBeans also customized templates can be used. As far as I could find the install-templates command could not be executed from within NetBeans, so you still need the Grails command line.

Code-completion and syntax color highlighting


The NetBeans 6.1 Groovy and Grails plugin offers Groovy code completion and syntax color highlighting. To bad the current version does not yet include code-completion for Grails dynamic methods.



Running a Grails application


From within NetBeans the Grails application can be started (run-app) using a context menu on application level.



Notice also the context menu item to generate a war archive or to see statistics.

Deploying a Grails application to GlassFish


Reading the other blog posting it is also possible to deploy your Grails application in GlassFish, but I didn't tested this myself yet.

Summary


My first experience with the NetBeans 6.1 Groovy and Grails plugin is good. Nice to have those context menu for executing the Grails commands from the IDE. However code completion, and specially for Grails dynamic methods, need to improve to really compete with IntelliJ. But I really believe this will happen in the near future!

Thursday, May 25, 2006

Using Facelets in NetBeans 5.5 (beta)



Although NetBeans 5.5 beta has no direct support for Facelets (yet?), you can successfully develop JSF Facelets applications with it, and take advantage of NetBeans' Java EE 5 platform support and other cool things.

In this this tutorial I will create a new Web Application in NetBeans 5.5 beta, based on the NumberGuess example included in the Facelets distribution. This tutorial assumes that you have basic JSF, Facelets and NetBeans knowledge. Before starting make sure you have the following in place:


The NumberGuess example is a simple application consisting of a couple of JSF pages and navigation rules and a single JSF managed bean. Follow the steps below to set up the NumberGuess project in NetBeans and deploy and run it from within the IDE.



  1. Register the Facelets library in NetBeans (Tools --> Library Manager). Create a New Library containing the jsf-facelets.jar from the Facelets distribution.

  2. Create a new Web Application project. Choose as Project Name numberguess (make sure the context path is also set to numberguess) and select the Java EE 5 server you installed as Server. Select Java Server Faces in the Frameworks step. Click Finish to create the project.

  3. NetBeans will automatically create an index.jsp and welcomeJSF.jsp. Delete both files as we will not be using JSP pages, but xhtml formatted JSF pages.

  4. Add the Facelets library to your project (Project Properties --> Libraries --> Add Library).

  5. Copy the tutorial directory (containing the managed bean class) from \facelets-1.1.4\demo\numberguess\src\ to your projects \src\java\ directory. NetBeans will refresh your project content automatically.

  6. Also copy all files from \facelets-1.1.4\demo\numberguess\web\ to your projects \web\ directory. Do NOT copy the \WEB-INF\ directory.

  7. Open your projects web.xml and add the folowing:
    <context-param>

    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

    <param-value>.xhtml</param-value>

    </context-param>

    Next, change the the Faces Servlet url pattern from /faces/* to *.jsf (next time you can do this when creating the project).

    Also completely remove the welcome file list configuration which was pointing to the deleted index.jsp file.

  8. Open your projects faces-config.xml and add the folowing:
    <application>

    <view-handler>

    com.sun.facelets.FaceletViewHandler

    </view-handler>

    </application>





    <!-- our NumberBean we created before -->

    <managed-bean>

    <managed-bean-name>NumberBean</managed-bean-name>

    <managed-bean-class>tutorial.NumberBean</managed-bean-class>

    <managed-bean-scope>session</managed-bean-scope>

    <managed-property>

    <property-name>min</property-name>

    <value>1</value>

    </managed-property>

    <managed-property>

    <property-name>max</property-name>

    <value>10</value>

    </managed-property>

    </managed-bean>

    <!-- going from guess.xhtml to response.xhtml -->

    <navigation-rule>

    <from-view-id>/guess.xhtml</from-view-id>

    <navigation-case>

    <from-outcome>success</from-outcome>

    <to-view-id>/response.xhtml</to-view-id>

    </navigation-case>

    </navigation-rule>

    <!-- going from response.xhtml to guess.xhtml -->

    <navigation-rule>

    <from-view-id>/response.xhtml</from-view-id>

    <navigation-case>

    <from-outcome>success</from-outcome>

    <to-view-id>/guess.xhtml</to-view-id>

    </navigation-case>

    </navigation-rule>



    The most important part is to configure the FaceletViewHandler to use Facelets as view technology. The other parts are just 'normal' JSF managed beans and navigation rules which you would also need without using Facelets.

  9. Deploy and Run your project.