Getting started with Griffin in five minutes

Source: Internet
Author: User

Copyright statement: the author chszs. All Rights Reserved. You are not allowed to reprint the copyright!

I. Introduction
Griffin is an application framework similar to grails. It is used to build rich desktop applications based on groovy, Java, swing, and other technologies.
Griffin uses a habit of being better than the configuration, which can automate many general development tasks and provide a wide range of plug-ins.
Griffin also has the ability to bind feature attributes to widgets and scalable event systems. These features make it an excellent choice to build rich Internet applications with Griffin on.
Griffin is a lifecycle framework that can be automated not only during application creation and maintenance, but also during build and deployment. Next, we will start to create, run, package, and deploy a Java WebStart application, so that you can quickly master the basic knowledge of Griffin.

Ii. Prerequisites
1. JDK 6

Download and install JDK 6 or later.

2. Griffin package
Download the Griffin on 1.0.2 release package in the http://griffon.codehaus.org/Download.
Http://dist.codehaus.org/griffon/griffon/1.0.x/griffon-1.0.2-bin.zip

3. Build the environment
1. decompress the griffin

Decompress Griffin -1.0.2-bin.zip to c: \ Griffin on.

2. Set Environment Variables
Set the environment variable named Griffin on_home and point the value to the decompressed directory.
Add the value of Griffin _home/bin to the path environment variable.
Note: Make sure to set the environment variables. Otherwise, you cannot execute the griffin command in the command line.
3. Verify
Run cmd to enter the command line mode and run the following command:
C: \ Griffin on \ bin> Griffin on help
Welcome to Griffin on 1.0.2-http://griffon-framework.org/
Licensed under Apache standard license 2.0
Griffin on home is set to: C: \ Griffin on
......
Note: The first running will automatically download and install or upgrade some libraries or packages, as shown below:
Griffon-swing-1.0.1-release.zip,
Griffon-jumpstart-1.3-release.zip,
Griffon-presentation-1.1-release.zip,
Griffon-swt-1.0-release.zip,
Ant-1.8.2.jar,
Ant-launcher-1.8.2.jar,
Ant-junit-1.8.2.jar,
Jansi-1.7.jar,
Jline-0.9.94.jar,
Commons-io-2.1.jar,
Commons-lang-2.6.jar,
Commons-codec-1.6.jar,
Commons-collections-3.2.1.jar,
Commons-beanutils-1.8.0.jar,
Httpcore-4.1.2.jar,
Httpclient-4.1.2.jar,
Jsch-0.1.45.jar,
Jzlib-1 .. 7.jar,
Http-builder-0.5.2.jar,
XercesImpl-2.9.1.jar,
Ezmorph-1.0.6.jar,
Xml-resolver-1.2.jar,
Griffon-cli-1.0.2.jar,
Griffon-scripts-1.0.2.jar,
Griffon-rt-1.0.2.jar,
Org. springframework. core-3.1.2.RELEASE.jar,
Org. springframework. beans-3.1.2.RELEASE.jar,
Org. springframework. context-3.1.2.RELEASE.jar,
Org. springframework. Context. suppor-3.1.2.RELEASE.jar,
Json-lib-2.4-jdk15.jar,
Log4j-1.2.16.jar,
Slf4j-api-1.6.4.jar,
Slf4j-log4j12-1.6.4.jar,
Jcl-over-slf4j-1.6.4.jar,
Jul-to-slf4j-1.6.4.jar,
Groovy-all-1.8.6.jar

4. Commonly Used commands of Griffin on
Griffin on add-proxy
Griffin app
Griffin on Archetype-Info
Griffin on clean
Griffin on clear-dependency-Cache
Griffin on clear-proxy
Griffin on compile
Griffin Console
Griffin on create-addon
Griffin on create-app
Griffin on create-Archetype
Griffin on create-command-alias
Griffin on create-integration-test
Griffin on create-MVC
Griffin on create-plugin
Griffin on create-script
Griffin on create-Service
Griffin on create-unit-test
Griffin on dependency-Report
Griffin Doc
Griffin on generate-View-script
Griffin on help
Griffin on init
Griffin on install-Archetype
Griffin on install-plugin
Griffin on integrate-
Griffin interactive
Griffin on list-Archetype-Updates
Griffin on list-archetypes
Griffin on list-plugin-Updates
Griffin on list-plugins
Griffin on list-Repositories
Griffin on Package
Griffin on package-Archetype
Griffin on package-plugin
Griffin on Plugin-Info
Griffin on release
Griffin on release-Archetype
Griffin on release-plugin
Griffin on remove-proxy
Griffin on replace-Artifact
Griffin on run-app
Griffin on run-Applet
Griffin on run-script
Griffin on run-WebStart
Griffin on set-proxy
Griffin on set-version
Griffin Shell
Griffin on stats
Griffin on test-app
Griffin on uninstall-Archetype
Griffin on uninstall-plugin
Griffin on Upgrade

Iv. Preliminary development
1. Create an application

Create an application and run the "Create-app" command. For example:
D: \ TMP> Griffin on create-app helloworld
Welcome to Griffin on 1.0.2-http://griffon-framework.org/
Licensed under Apache standard license 2.0
Griffin on home is set to: C: \ Griffin on

Base Directory: D: \ TMP
Running script c: \ Griffin on \ scripts \ createapp _. Groovy
Resolving dependencies...
Dependencies resolved in 538 Ms.
Environment set to development
Resolving framework plugin dependencies...
Framework plugin dependencies resolved in 725 Ms.
[Mkdir] created dir: D: \ TMP \ helloworld \ Griffin on-app
[Mkdir] created dir: D: \ TMP \ helloworld \ Griffin on-app \ conf
......
Created tests for helloworld
Created Griffin on application at D: \ tmp/helloworld

2. Run the application
Applications created with Griffin are desktop applications. Users can install and Applet applications, so they can run applications in browsers or run them using WebStart.
Griffin hides the differences between different platforms and makes applications portable.

There are three ways to run an application:
(1) run the program as a desktop application
D: \ TMP> Cd helloworld
D: \ TMP \ helloworld> Griffin run-app
Welcome to Griffin on 1.0.2-http://griffon-framework.org/
Licensed under Apache standard license 2.0
Griffin on home is set to: C: \ Griffin on

Base Directory: D: \ TMP \ helloworld
Running script c: \ Griffin on \ scripts \ runapp. Groovy
Resolving dependencies...
......
Launching application...
18:18:51, 273 [main] info grion. Swing. swingapplication-initializing all startup groups: [helloworld]
A window program is displayed, as shown below:

Figure 1:
Close this window program and output:
18:22:48, 436 [AWT-EventQueue-0] info Griffin on. Swing. swingapplication-shutdown is in process
[Delete] deleting Directory D: \ TMP \ helloworld \ staging \ windows64
[Delete] deleting Directory D: \ TMP \ helloworld \ staging \ WINDOWS

It can be seen that the first method is implemented through the swing library.

(2) run in a browser as an applet
D: \ TMP \ helloworld> Griffin run-Applet
Welcome to Griffin on 1.0.2-http://griffon-framework.org/
Licensed under Apache standard license 2.0
Griffin on home is set to: C: \ Griffin on
......
[Copy] copying 11 files to D: \ TMP \ helloworld \ staging
[Copy] copying 19 files to D: \ TMP \ helloworld \ Dist \ Applet
[Copy] copied 5 empty directories to 4 empty directories under D: \ TMP \ hello
World \ Dist \ Applet
[Zip] building ZIP: D: \ TMP \ helloworld \ Dist \ applet \ helloWorld-0.1-applet.zip
Figure 2:

Since JDK 7 is installed and there is an exception in the running of Griffin, JDK 6 is officially recommended.

(3) Run as in the JNLP WebStart Project
D: \ TMP \ helloworld> Griffin on run-WebStart
Welcome to Griffin on 1.0.2-http://griffon-framework.org/
Licensed under Apache standard license 2.0
Griffin on home is set to: C: \ Griffin on
......
[Copy] copied 5 empty directories to 4 empty directories under D: \ TMP \ hello
World \ Dist \ WebStart
[Zip] building ZIP: D: \ TMP \ helloworld \ Dist \ WebStart \ helloWorld-0.1-webstart.zip
Figure 3:

It is also a jdk7 issue. No wonder jdk6 is always recommended on the official website.

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.