How to develop a grails project under NetBeans

Source: Internet
Author: User
Tags create domain grails netbeans
Since some people say that NetBeans's support for grails is a bit better than eclipse, I've also tried how NetBeans projects are developed in the same way. It is also troublesome to hear that the version of the Grails plugin was installed prior to NetBeans, but in the last two days I went to the Grails official web site and found that the latest NetBeans 6.5 has already been integrated with the Grails plugin by default. It's Tray.

Here's how to use NetBeans 6.5 for grails development by referring to the Quick Start manual on the Http://www.grails.org/NetBeans+Integration website. Of course, the period will also insert some of my personal experience of use.

The first step: Prepare for Work

Download and install Grails, including setting grails_home and other environment variables to ensure that you can work properly under CMD;

Download and install the Web & Java EE version of NetBeans 6.5 (as of now, this version is still a beta version);

The point here is that the above two steps are upside down on the official web, and there is a further step to setting the Grails installation path in the NetBeans Options window, which is actually superfluous. If you install Grails first, then NetBeans will be able to find its path instead of setting it yourself.


Step Two: Create an application

It's going to be quick. The second step is to start creating the application. Select New project, as shown in figure:


Click Next to enter the project name:


Click Finish, so the general framework for the entire Grails project has been created by NetBeans.


Step Three: Create domain class

Everything came fast. According to the Grails entry tutorial, even if you don't do this, you can see an initialization interface when the project is running. And until now, you don't need to know any grails cmd commands.

Right-click the domain Classes under the project, and choose a new domain Class, as shown in:


Then follow the wizard to fill in the information such as the class name.


Then enter a few of the fields in the created class.


Open configuration-> Bootstrap.groovy, and enter some code that can produce several initialization records.


Fourth Step: Create the Controller class

Right-click Controllers, and choose a new controller, as shown in the figure:


Fill in the class name and other information, click Finish.


Comment out one of the statements in the Auto-generated class, and then enter the Def scaffold = book in the same position.


Step Fifth: Start the project

Right-click the project, select the Run command, and the project starts ... All you have to do is wait for the project to start, and it will automatically eject the browser window and visit the home page of the application you created.


At this point you can click on the controller you just created.


When you start, you will also see the newly released project under Servers-> jetty in the services panel.




This simple five-step, has been completed from the build environment to the first application to run. And without ever asking you to type in any of the grails commands that resemble Create-domain-class, the degree to which NetBeans considers you to be thoughtful is not a complete one. In fact, every key step, NetBeans calls to grails which commands can be viewed in the output panel, as shown in figure:

#操纵bit流_java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.