»
S
I
D
E
B
A
R
«
Evejob Development Environment Installation Part #8: Configuring applications to work with MySQL
Nov 2nd, 2009 by evereq

Django

We will need to use MySQL for Python project for connection from Django Python code to MySQL database. Because I (and hope you also) use Windows 7 64 bit with Python 64 bit, needs to found and install 64 bit version of such library. On original project site, for some reason I could not found (at least in the moment when I write post), so I get it from different site:  http://www.codegood.com/download/3/. Just download and install it (it will automatically found your Python installation if you follow all steps that I write in previous posts).

Let’s configure now, EvejobDJ project to use MySQL database.

First, needs to create “EvejobDJ” database schema using one of the administration tools, for example, described in Part #7 – just create it visually or issue following SQL command:

CREATE DATABASE EvejobDJ;

Open “settings.py” file in root folder of EvejobDJ project inside IntelliJ IDEA IDE and change database engine parameters to following:

DATABASE_ENGINE = 'mysql'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'evejobdj'         # Or path to database file if using sqlite3.
DATABASE_USER = 'root'                # Not used with sqlite3.
DATABASE_PASSWORD = ''             # Not used with sqlite3.
DATABASE_HOST = ''                     # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''                     # Set to empty string for default. Not used with sqlite3.

Now it is time to test connection and create default tables in database (for authentication, sessions etc):

cd C:\Evejob\EvejobDJ
python manage.py syncdb

Hopefully you will get something like this in response:

EvejobDJDatabaseCreate

As you see you will need to create default “superuser” (I just put “admin” as his username and “info at evejob.com” as his email) because Django authentication app enabled by default.

Now you can check in MySQL database administration tool that you really create tables (screenshot from free MySQL Administrator that you probably install with MySQL GUI Tools):

MySQLEvejobDJDatabaseJustCreated

Ruby On Rails

To use MySQL in Ruby On Rails (RoR) we need to install MySQL Adapter, for example:

ruby -S gem install mysql

But here we get into trouble – binaries of this gem (mysql) does not work correctly on Windows 64 bit and on project site there is no version for 64 bit OS…
While on some “Unix” OS it is possible to fix this issue (for example build gem from source…), on Windows it is simply not possible…
Ah, OK, OK… it is possible, but just too complex / time consuming – don’t want to spend time on this NOW and leave this time to focus on coding of Evejob… maybe somebody or author of gem will fix this issue later!

Note: other available adapters for MySQL from Ruby seems also have same problems… at least by now.

So let’s just temporary switch to PostgreSQL for Ruby on Rails version of Evejob.

To setup PostgreSQL for EvejobRoR development it takes just few minutes:

  • Download and install latest PostgreSQL from http://www.enterprisedb.com/products/pgdownload.do#windows. Installation is trivial same like for MySQL (sure same – configuration is NOT trivial for production usage!). Make sure that you remember password that you put for “postgres” login role (default database user name).
  • Create “EvejobRoR_development” database in PgAdmin (this app comes with PostgreSQL… very similar to MySQL Administrator) and select “postgres” role as owner for this database.
  • Open EvejobRoR project in IntelliJ IDEA and copy file “config\database.yml” to “config\database_mysql.yml” (we will need it again when fix issue with MySQL + Ruby)
  • Edit file “config\database.yml” and enter here following information (make sure you put your password instead of my fake “admin”):
    development:
      adapter: postgresql
      encoding: utf8
      reconnect: false
      database: EvejobRoR_development
      pool: 5
      username: postgres
      password: admin
      host: localhost
     
    test:
      adapter: postgresql
      encoding: utf8
      reconnect: false
      database: EvejobRoR_test
      pool: 5
      username: postgres
      password: admin
      host: localhost
     
    production:
      adapter: postgresql
      encoding: utf8
      reconnect: false
      database: EvejobRoR_production
      pool: 5
      username: postgres
      password:  admin
      host: localhost
  • Execute following commands:
    ruby -S gem install postgres-pr

    This will install PostgreSQL adapter for Ruby (gem “postgres-pr” works on Windows x64)

    Now you can try to execute database “migration” that will hopefully create some stuff in development database:

    cd c:\Evejob\EvejobRoR
    c:\ruby\bin\rake db:migrate

    It will be to simple if this will work for you from first attempt! On my machine, I was need to made small “hack” to made this work, i.e. to add following code into new_rails_defaults.rb file in “config\initializers” folder and run db:migrate again:

    def PGconn.quote_ident(name)
        %("#{name}")
    end

    (look for more info about this “hack” here)

If you complete everything, you can check that db:migrate actually create one table (”schema_migrations”) in your development database:

pgAdmin_Shema_migrations_table

Grails

Let’s configure last version of Evejob which going to use MySQL database – EvejobGoG.

First, needs to create “evejobGoG_development”, “evejobGoG_test” and “evejobGoG_production” empty databases. You can do this trivial task using MySQL Administrator GUI Tool for example.

Next step is to let know Grails how to connect to just created MySQL databases. Because Grails runs on Groovy and Groovy itself runs in JVM we can use MySQL Connector/J from MySQL site: http://dev.mysql.com/downloads/connector/j/

Download “zip” file, unpack it to temporary folder and copy mysql-connector-java-x.x.xx-bin.jar file to the C:\evejob\EvejobGoG\lib folder.

Now open EvejobGoG project in IntelliJ IDEA and found DataSource.groovy file located in “EvejobGoG\Grails-app\conf” folder. Let’s change some settings in this file:

dataSource {
	pooled = true
	driverClassName = "com.mysql.jdbc.Driver" //"org.hsqldb.jdbcDriver"
	username = "root"
	password = ""
    dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true
    cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider'
}
// environment specific settings
environments {
	development {
		dataSource {
			dbCreate = "update" // one of 'create', 'create-drop','update'
			url = "jdbc:mysql://localhost/evejobGoG_development" // "jdbc:hsqldb:mem:devDB"
		}
	}
	test {
		dataSource {
			dbCreate = "update"
			url = "jdbc:mysql://localhost/evejobGoG_test" // "jdbc:hsqldb:mem:testDb"
		}
	}
	production {
		dataSource {
			dbCreate = "update"
			url = "jdbc:mysql://localhost/evejobGoG_production" // "jdbc:hsqldb:file:prodDb;shutdown=true"
		}
	}
}

Now Grails know how to connect to MySQL. Unfortunately, there is no build-in database migrations functionality in Grails framework yet, so our next step is to install some plug-ins that can help us to maintain database schema versions and migrations. While exists few of such plug-ins, I think most “featured” is LiquiBase (but also you can take a look into “Autobase” if you prefer to dial with DSL instead of XML… just take a note that this plugin works only with Grails, while LiquiBase can be used with Ant, Maven, Spring etc or even independently as database change management solution)

To install LiquiBase do following (you can read more regarding Grails integration with LiquidBase here):

cd C:\evejob\EvejobGoG
grails install-plugin liquibase

Now check that you have following folder (that is empty by now):

C:\evejob\EvejobGoG\grails-app\migrations

If you don’t have folder yet, just create it before continue with migrations – this folder will be used to save migrations change log etc..

Now it’s time to generate change log and migrate database (that is empty for now) to initial version:

grails generate-changelog grails-app\migrations\changelog.xml
grails migrate

After first command (”generate-changelog”) LiquiBase will create initial version of database change log and save it to the “C:\evejob\EvejobGoG\grails-app\migrations\changelog.xml” file. It will looks something like following:

Second command (”grails migrate”) will actually made migration in database. In our case because our domain is empty, LiquiBase will just create changes maintenance tables: “databasechangelog” and “databasechangeloglock”. You can check now this using MySQL Administrator:

LiquiBaseInitialTables

If all steps above completed successfully you finish setup EvejobGoG Grails project to use MySQL Database and have ability to migrate databases!

Evejob Development Environment Installation Part #7: Installation of MySQL Database & Tools
Nov 1st, 2009 by evereq

We are going to use MySQL database for all “Evejob” versions, except versions for  .NET platform.

So let’s install MySQL Community Edition Server. You can get installation files from http://dev.mysql.com/downloads/mysql/

Be sure that you download 64 bit version for Windows, like Windows MSI Installer (AMD64 / Intel EM64T), from here http://dev.mysql.com/downloads/mysql/5.1.html#winx64 for example.

Installation of MySQL for Windows is simple operation (in contrast to configuration MySQL for production usage), so I will skip installation steps here… We can leave all settings by default – it’s enough for development purposes on local machine.

To manage database you can download GUI Tools from http://dev.mysql.com/downloads/gui-tools/.

Also note that exists A LOT of free / not free and excellent tools to manage / design MySQL databases (for both development and production).

I will list here just some of them:

  • MySQL Workbench – “visual database design application that can be used to efficiently design, manage and document database”
  • Navicat for MySQL – powerful database administration and development tool (without complex visual design features) available in both commercial and Non-commercial (Free) Lite version
  • DevArt dbForge Studio for MySQL – “cutting-edge administration tool and development environment for professional working with MySQL databases” and this is TRUE! Best that I see for MySQL!!! Highly recommended! Sure Express version (that is free) is very limited, so probably after 30 days trial period you will buy Non-Commercial Professional Edition License (cost only 99$) or Commercial for 199$ (more info about versions / prices here)
  • SQLyog MySQL – “the most powerful MySQL manager and admin tool, combining the features of MySQL Query Browser, Administrator, phpMyAdmin and various other MySQL Front Ends and MySQL GUI tools in a single intuitive interface” – actually I think this tools make sense to use more during maintenance period than during development and because they are not free I recommend to skip them for now…

After installation of MySQL, you just need to know for development following information (that you setup during installation):

  1. Server Host (”localhost” in your case, if you install it on your local machine) and port (default 3306)
  2. Username (usually root)
  3. Password (you enter it during installation of MySQL or even possible you leave it blank – sure NOT for production!)

Now using this connection parameters, you can run MySQL Administrator (from GUI MySQL Tools) or any administrator utility and check connectivity. If everything OK and you see all 3 schemes (”information_schema”, “mysql” and “test”), you can move forward and start development using MySQL as primary database.

GNU General Public License version 2 (GPLv2)
Oct 31st, 2009 by evereq

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software–to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author’s protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors’ reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone’s free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Evejob Development Environment Installation Part #2: IntelliJ IDEA and Plugins Installation
Oct 21st, 2009 by evereq

Let’s start with installation and configuration of the IntelliJ IDEA IDE for RoR / GoG / Django and Google App Engine development.

At the time I write this article, version 8 is available and version 9 (Maia) only at pre-release stages… So we start development in version 8 (but with really huge interest we will wait for version 9!). Also please note that community version of IDE is lack some important functions, so we going to use commercial version (30 day trial will be enough to start)

So go to http://www.jetbrains.com/idea/, download and start installation of Windows version of IntelliJ IDEA. During installation you need to select the plugins to enable. Made following selection (I am going to use Git and Subversion version controls systems in Evejob project)

SelectVCS

On next screen, when IDEA will ask you about Web/JavaEE plugins I recommend to leave all options selected (unless you know that you not going to use some of Java technologies in near future) dues to the fact that when we move to Grails development, some of this plug ins will be in used.

On “Select Application Server Plugins” I also recommend to leave all options, as probably we will want to test hosting of application on as much Web Servers as possible (unless you know specific server requirements) – it is exactly way I am going to develop Evejob!

Same way, I recommend to leave all HTML / JavaScript development Plugins and Other Plugins selected (unless you know for sure which one you going to use and which one not… seems effort to enable them later can be more then performance issues in case if you just leave everything enabled, at least on latest hardware).

In case if you have only one developer machine, on next screen with “IDEA Server Account details” you can just select “Do not login”, press “Skip”

DontLogin

and move forward to the end of installation.

Finish!

But wait – it’s not all – we need also to install plugins for RoR, Django and even Google AppEngine (Grails support build in to IntelliJ IDEA 8)…

Let’s start:
- go to File / Settings
- in Settings window found at left list box “Plugins” item and select it.

- open tab Available

- wait few seconds, until get a list of all available plugins in JetBrains database.

- in search box, start typing “Python”.

- select “Python” plugin in filtered list

- right click and press “Download and Install” link

IntelliJPythonPlugin

Plugin will be downloaded and installed for you (usually takes few minutes)!

Now it is time to install same way “Ruby” and “Google App Engine” plugins…

After you install all 3 plugins, press “Apply” button and answer “Yes” to the question about restart IDEA to activate changes in plugins.

That’s it with IntelliJ IDEA installation!

Evejob Development Environment Installation Part #4: Groovy, Grails + AppEngine Installation
Oct 18th, 2009 by evereq

Grails Installation

To install Grails follow steps:

1) Download and install JDK from http://java.sun.com/javase/downloads. Make sure that you use following version

Java SE Development Kit (JDK)

JDK 6 Update X

Note: You don’t need Bundles packages. Also make sure that you download Windows x64 version of JDK, like on screenshot bellow:

JDKDownload

Let’s assume that you download and install JDK to following default location: C:\Program Files\Java\jdk1.6.0_16

2) Download latest stable Grails Binary ZIP Release from http://www.grails.org/Download, for example: grails-bin-1.1.1.zip. We not going to install Grails from sources (build it) due to the fact that Grails support “grails update” command, which can update your Grails version to latest one.

3) Extract Grails archive to the following folder: C:\Grails

4) Create JAVA_HOME environment variable that points to the path where you have installed JDK and create a GRAILS_HOME environment variable that points to the C:\Grails folder:

JAVA_HOME_variable GRAILS_HOME_variable

Note, make sure you enter your system path to JDK and JDK version that you install before.

5) Append %GRAILS_HOME%\bin to the PATH variable:

GrailsPath

6) Check that Grails installed successfully - just type “Grails” in command prompt and check that you get a help message like:

GrailsWelcome

OK, installation of Grails finishes here, let’s move to the next task…

EvejobGoG and EvejobGoGG projects configuration

So let’s start to create EvejobGoG project that is build on  Grails and EvejobGoGG also build on Grails but specially adjusted to be hosted by Google App Engine.

First Start IntelliJ IDEA, open “Create New Project”, select “Grails Application” and enter project files location as “C:\evejob\EvejobGoG”:

EvejobGoGCreate

Press Next and on Grails SDK window, press “New” to add new one and in “Select Path” window select “C:\Grails” folder (where you install Grails before):

GrailsSDKSelectionInIDEA

You will get something like this (your version of Grails can be different):

GrailsSDKSelectionFinished

Press “Next” and on next window (Select the desired technologies) leave all options unselected. After you press “Finish” you will get new Grails project opened in IDEA (if during this phrase IDEA will ask you about some updates in Grails Tool Window, press “y” to do so):

GrailsEvejobGoGProjectInIDEA

Now you can repeat same steps to create EvejobGoGG project that will use Google App Engine.

But first let’s install Google App Engine SDK for Java.

Go to the http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Java and download Zip file that contains SDK (usually file have name like “appengine-java-sdk-1.2.6.zip”). Than create folder C:\Google\google_appengine_java_sdk and unzip archive content to this folder. That’s it – Google App Engine Java SDK installed.

Let’s setup environment variable which is used by Grails plugin to locate App Engine Java SDK – APPENGINE_HOME (in our system we install it to C:\Google\google_appengine_java_sdk folder):

APPENGINE_HOME_variable

Let’s reload IDEA so environment changes takes effect (we will use APPENGINE_HOME variable in a second).

Now let’s continue with IDEA and setup EvejobGoGG project same way like we create and setup EvejobGoG (all step exactly same like above).

IntelliJ Idea provide great support of Grails development build-in. For example it is very simple to install Grails Plug-ins directly from IDE (make sure that you select EvejobGoGG project in IDEA window):

GrailsPluginsInIDEA

Ones you open Grails plugins window, probably you will need to press “Reload Grails Plugin” button, to get a full list of available plugins:

GrailsPluginsReload

Type “app” in search box and select “app-engine” plugin (”Grails AppEngine plugin”). Check check box “Enable” and press “Apply Changes”. Than select latest release version of the plugin, for example:

GrailsAppEnginePluginVersion

OK, let’s back to plugin installation – press “OK” on plugin installation window and in Grails window you will probably get question “Do you want to use JPA or JDO for persistence”. Let’s for now just answer “jpa” and finish plugin installation.

Finished… Ah, ups… Let’s just check that project structure is OK – go to “File / Project Structure” window:

ProjectStructureCheck

Sometimes (looks like due to some bug in IDEA currently???) you will not get Project SDK configured:

ProjectSDKNotConfigured

If you in this situation (hopefully not, but just in case), press “New” button,  select “JSDK” in drop down and browse to your JDK path:

JDKPath

After, press “Apply” and you will add JDK to EvejobGoGG project.

Do the same check (and probably fix) for EvejobGoG project.

»  Substance: WordPress   »  Style: Ahren Ahimsa
© Copyright 2008–2009 EvereQ.com All rights reserved.