| CARVIEW |
|
coyote
|
| Summary | Dynamic/scripting language support in NetBeans |
|---|---|
| Categories | None |
| License | Sun Public License (SPL) |
| Owner(s) | ttran |
The goal of this project is to develop a set of NetBeans modules to help developers write code in dynamic languages using the NetBeans IDE. Initially, we are targeting the the Groovy and Jython languages, but we anticipate a common framework allowing support for more languages.
The coyote is a quiet, efficient animal that thrives in urban and rural settings without any particular encouragement, and once established in an ecosystem, is virtually impossible to eradicate.
Why dynamic languages? Why NetBeans?
Dynamic (also called "scripting") languages are growing in mindshare,
popularity and respectability.
What they lack in type-safety and compile-time checking they make up for in
expressiveness; put simply, you can often do the same amount of work in fewer
lines of code (and just as safely if you are using Test-Driven Development).
The Java platform has always, in principle, been able to support the use of languages other than Java. In fact there are currently nearly 200 JVM-based languages at various stages of development, and the Java development community is now actively reaching out to the dynamic-language community.
The combined use of Java and dynamic languages on the Java platform can boost developer productivity considerably.
NetBeans is a full featured IDE written in pure Java which provides support for a wide range of technologies from J2ME, J2SE and J2EE. Its architecture is module-centric: the IDE itself comprises the core and more than a hundred modules.
What works
- Support for Groovy and Jython languages
- Script files can be created/edited/executed. The scripts are able to access the project's CLASSPATH.
- Syntax coloring for both languages - Groovy and Jython
- Special scripting (Jython/Groovy) project types. Scripts are in a separate folder structure. For scripting projects, normal compile/execute works using Ant.
- Syntax error hyperlinking to the source after compile or execute.
- Support for servlets written in Jython and for Groovlets
- Support for writing unit tests in Jython and Groovy
Download, Installation and Setup
You should have NetBeans IDE 5.0 already installed. If not, get it from the NetBeans website. The updated Coyote modules milestone 2 (Mar/2006) support only latest stable release - NetBeans 5.0. Currently we support Groovy (milestone 2 was tested with groovy-1.0-jsr-05.zip) and Jython. You don't need both, but you should have at least one of them installed. We are developing and testing with the latest versions.
Go to Document & Files and get the latest snapshot build for NetBeans 5.0. Then
- Unzip the distribution zip file (there are several .nbm files, they are NetBeans modules)
- Run NetBeans IDE
- Go to menu Tools -> Update Center
- Select "Install Manually Downloaded Modules"
- Add the unzipped modules to install
- Accept the license and finish the installation
Setup:
- Go to menu Tools -> Options
- Select Options -> Building -> Groovy/Jython
- Specify the Groovy/Jython home path
How to use it / quick start
Simple script execution:
- Create or open any project (e.g. Java Application)
- Create new Empty File and name it for example "myscript.groovy"
- Script can be executed. Choose "Execute Script" in popup menu
- Script output is printed to bottom part of the IDE window
- Errors are hyperlinked in the output, the appropriate source should be opened when you click on it. It doesn't work always for Groovy (see this bug)
Script editing:
- Script can be opened to editor ("Open" in popup menu)
- Syntax coloring works for both supported languages - Groovy and Jython
- To customize syntax coloring:
- Go to menu Tools -> Options
- Select Options -> Editing -> Editor Settings -> Groovy/Jython
- Select Fonts and colors in properties and press "..." button
Scripting projects:
- Create new project, select "Scripting" category and choose any of the project types
- Specify the project name
- Specify main script name
- Finish the New project wizard
- Now you can edit the main script or add other scripts
- All standard project actions (using Ant tasks) are available now (from toolbar/menu or using shortcuts): "Build Project", "Clean Project", "Execute Project", etc.
- For editing Jython/Groovy projects, open the popup menu for the project and select properties. It is possible to change all of the project settings here including the main script and the Groovy/Jython home.
Unit tests support:
- Select Java source in a J2SE project
- Right click on source -> Tools -> Jython (or Groovy) tests -> Create Tests
- Edit the generated test skeleton
- Run the test - from editor or Right click on source -> Tools -> Jython (or Groovy) tests -> Run Test
Servlets support:
- Create and run a simple servlet:
- Create a web project (File -> New project -> Web -> Web Application)
- Select Web Pages folder
- Create Jython or Groovy servlet (File -> New File -> Web -> Jython servlet (or Groovlet)
- Press 'F6' (Run the web project)
- Append the name of your servlet after the url that has popped up in your browser
- Edit the servlet and just reload in browser (no need to build, just save your changes)
- To make your Jython servlet/Groovlet the first page of Web project:
- Select Web project in explorer
- R-click popup menu -> Properties
- Select Run
- Type your servlet name - e.g. '/myGroovlet.groovy'
- If you want to make existing Web project Groovy/Jython compliant:
- Select Web project (or any file under it) in explorer
- Go to Tools -> Make WebApp Jython (Groovy) Compliant
- This action modifies web.xml and add appropriate libraries to the project classpath
- This action is done automatically whenever you create new Jython servlet/Groovlet inside a Web project
To-do list
Future development:- Indentation engine will help to format the scripts files
- Code folding
- Syntax error highlighting in the editor without compile
- Scripting console
- Code completion
- Debugging
Source code and building
Step 1: Checkout whole coyote cvs project:
CVS client setup
Step 2: Launch NetBeans 5.0
Step 3: Install lexer modules from directory lexer-nbms using update center. They need to be installed globally (not into the userdir!), otherwise you won't be able to compile coyote.
Step 4: Open project coyote-suite and invoke the Build All action from project context menu
-> All modules are built now. After this you will be able to build coyote using main build.xml.
Step 5: Create zip distribution with nbms
To create a single zip with all nbms, go to coyote main directory and execute zip target on
build.xml (or run "ant zip" from command line). This file can be accessed through favorites
view from the IDE.
-> Distribution file is created in coyote directory: e.g. coyote/coyote-nbms-060308.zip.
For troubleshooting see full build instructions.
Help wanted!
If you're interested in contributing, you can file bugs/RFEs or subscribe to our mailing list. If you're really interested, we'd welcome any developers who wanted to roll up their sleeves and participate; in particular ones who already use Jython or Groovy. Or, if you think Ruby, JScheme, Kawa, Rexx, or your favorite language needs a NetBeans home, get in touch!
| Powered by CollabNet | Feedback |
FAQ |
Press |
Developer tools
© 1995 - 2007 CollabNet. CollabNet is a registered trademark of CollabNet, Inc. |
