Quickstart guide for "Hello, DAO!"

33 views
Skip to first unread message

Vojtech Szocs

unread,
Jun 20, 2009, 3:28:15 PM6/20/09
to DAO Fusion
Hi everybody,

here is a quick guide on how to build and run the "Hello, DAO!" sample
application from scratch. It will walk you through all the necessary
steps (including setting up all required development tools).

Here we go:

= 1 = Maven ==============================

A) download Maven and extract it to some folder, for example: C:\Dev
\apache-maven-2.1.0
http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.1.0-bin.zip

B) open MAVEN_HOME\conf\settings.xml and paste following code in
<mirrors> section:

<mirror>
<id>ibiblio.org</id>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>

C) add Maven binaries to your system path, in Windows: My Computer |
Properties | Advanced | Env. Variables --> System Variables section

Click New:
name = M2_HOME
value = C:\Dev\apache-maven-2.1.0 (or the folder you extracted Maven
to)

Click New:
name = MAVEN_OPTS
value = -Xms48m -Xmx512m

Click on "Path" variable and select Edit, add the following to its
value:
...;%M2_HOME%\bin;

D) select OK and verify that Maven is on your system path by executing
"cmd" and typing this:

mvn --version

This should print out something like this:
Apache Maven 2.1.0 (r755702; 2009-03-18 20:10:27+0100)
... etc etc ...

= 2 = Ant ================================

A) download Ant and extract it to some folder, for example: C:\Dev
\apache-ant-1.7.1
http://apache.phphosts.org/ant/binaries/apache-ant-1.7.1-bin.zip

B) add Ant binaries to your system path, in Windows: My Computer |
Properties | Advanced | Env. Variables --> System Variables section

Click New:
name = ANT_HOME
value = C:\Dev\apache-ant-1.7.1 (or the folder you extracted Ant to)

Click on "Path" variable and select Edit, add the following to its
value:
...;%ANT_HOME%\bin;

C) select OK and verify that Ant is on your system path by executing
"cmd" and typing this:

ant -h

This should print out something like this:
ant [options] [target [target2 [target3] ...]]
... etc etc ...

= 3 = Eclipse + Google Plugin for Eclipse ==========

A) download Eclipse 3.4 (Ganymede) and extract it to some folder:
http://www.eclipse.org/downloads/

B) run Eclipse and set up your SVN provider and connector plugins by
using following update sites (Help | Software Updates | Available
Software | Add Site):

http://download.eclipse.org/technology/subversive/0.7/update-site/
(Subversive SVN team provider)

[ restart Eclipse ]

http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
(Subversive SVN connectors + SVNKit implementation)

C) install Google Plugin for Eclipse:
http://dl.google.com/eclipse/plugin/3.4

[ restart Eclipse ]

= 4 = Check out Hello, DAO from trunk ============

A) in Eclipse, switch to SVN perspective and right click in SVN
Repositories window: New | Repository Location

URL = http://daofusion.googlecode.com/svn

B) browse to /trunk/samples and right click on hello-dao folder: Check
out

= 5 = Build and run Hello, DAO ==================

A) go to your workspace directory where you checked out Hello, DAO and
run this command:

mvn eclipse:eclipse

Maven will now download all dependencies and generate Eclipse project
files - this might take a minute or two.

B) after you see this:

BUILD SUCCESSFUL

go to Eclipse and refresh your project (right click and Refresh)

C) and finally, start the application by running this:

mvn clean jetty:run

Maven will do a clean project build (GWT compilation is done by
calling Ant from the build itself) - this can take a minute or two.

After you see this:

[INFO] Started Jetty Server

fire up your browser with following address:

http://localhost:8080/hellodao/init

This will initialize Hello, DAO test data and redirect you to the
actual application sitting on http://localhost:8080/hellodao/.

Now you can explore the application sources in Eclipse. Note: you can
skip the "client" package if you're not familiar with Google Web
Toolkit (GWT).

Vojtech

huss...@gmail.com

unread,
Jun 21, 2009, 1:00:22 AM6/21/09
to DAO Fusion
Thanks Vojtech.

I can run the example now.
And I have the fix for your guide

= 4 = Check out Hello, DAO from trunk ============
Add step C) for the person who use Subclipse plugin
After you follow the step B) eclipse will show the
wizard to create project before start downloading files.
I recommend you to select Project (Plain project under
General group) instead of other kind of project.
We will now use mvn jetty:run instead of using virtual server
feature that are built-in to WTP (Web Tool Platform)
So no need to select "Dynamic Web Project"

= 5 = Build and run Hello, DAO ==================
You may found error after "mvn eclipse:eclipse" was executed.
Because 2 libraries are missing.
com.springsource.org.apache.commons.logging-1.1.1.jar
and aop library (I cannot remember its name)
How to fix that?
Open pom.xml in the project directory
Add the following snippet under <repositories>
next to smartgwt-rorschach-repo

<!--
Spring Source dependency fix
-->
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource
Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>

<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle
Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>

<repository>
<id>com.springsource.repository.libraries.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource
Library Releases</name>
<url>http://repository.springsource.com/maven/libraries/release</
url>
</repository>

<repository>
<id>com.springsource.repository.libraries.external</id>
<name>SpringSource Enterprise Bundle Repository - External Library
Releases</name>
<url>http://repository.springsource.com/maven/libraries/external</
url>
</repository>

Now every work fine! The example go live.

Hussachai

On Jun 21, 2:28 am, Vojtech Szocs <vojtech.sz...@gmail.com> wrote:
> Hi everybody,
>
> here is a quick guide on how to build and run the "Hello, DAO!" sample
> application from scratch. It will walk you through all the necessary
> steps (including setting up all required development tools).
>
> Here we go:
>
> = 1 = Maven ==============================
>
> A) download Maven and extract it to some folder, for example: C:\Dev
> \apache-maven-2.1.0http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.1....
> \apache-ant-1.7.1http://apache.phphosts.org/ant/binaries/apache-ant-1.7.1-bin.zip
>
> B) add Ant binaries to your system path, in Windows: My Computer |
> Properties | Advanced | Env. Variables --> System Variables section
>
> Click New:
> name = ANT_HOME
> value = C:\Dev\apache-ant-1.7.1 (or the folder you extracted Ant to)
>
> Click on "Path" variable and select Edit, add the following to its
> value:
> ...;%ANT_HOME%\bin;
>
> C) select OK and verify that Ant is on your system path by executing
> "cmd" and typing this:
>
> ant -h
>
> This should print out something like this:
> ant [options] [target [target2 [target3] ...]]
> ... etc etc ...
>
> = 3 = Eclipse + Google Plugin for Eclipse ==========
>
> A) download Eclipse 3.4 (Ganymede) and extract it to some folder:http://www.eclipse.org/downloads/
>
> B) run Eclipse and set up your SVN provider and connector plugins by
> using following update sites (Help | Software Updates | Available
> Software | Add Site):
>
> http://download.eclipse.org/technology/subversive/0.7/update-site/
> (Subversive SVN team provider)
>
> [ restart Eclipse ]
>
> http://www.polarion.org/projects/subversive/download/eclipse/2.0/upda...
> (Subversive SVN connectors + SVNKit implementation)
>
> C) install Google Plugin for Eclipse:http://dl.google.com/eclipse/plugin/3.4
>
> [ restart Eclipse ]
>
> = 4 = Check out Hello, DAO from trunk ============
>
> A) in Eclipse, switch to SVN perspective and right click in SVN
> Repositories window: New | Repository Location
>
> URL =http://daofusion.googlecode.com/svn
>
> B) browse to /trunk/samples and right click on hello-dao folder: Check
> out
>
> = 5 = Build and run Hello, DAO ==================
>
> A) go to your workspace directory where you checked out Hello, DAO and
> run this command:
>
> mvn eclipse:eclipse
>
> Maven will now download all dependencies and generate Eclipse project
> files - this might take a minute or two.
>
> B) after you see this:
>
> BUILD SUCCESSFUL
>
> go to Eclipse and refresh your project (right click and Refresh)
>
> C) and finally, start the application by running this:
>
> mvn clean jetty:run
>
> Maven will do a clean project build (GWT compilation is done by
> calling Ant from the build itself) - this can take a minute or two.
>
> After you see this:
>
> [INFO] Started Jetty Server
>
> fire up your browser with following address:
>
> http://localhost:8080/hellodao/init
>
> This will initialize Hello, DAO test data and redirect you to the
> actual application sitting onhttp://localhost:8080/hellodao/.

huss...@gmail.com

unread,
Jun 21, 2009, 1:14:53 AM6/21/09
to DAO Fusion
Fix my own post.
= 4 = Check out Hello, DAO from trunk ============
Add step C) for the person who use Subclipse plugin
After you follow the step B) eclipse will show the
wizard to create project before start downloading files.
I recommend you to select Project (Plain project under
General group) instead of other kind of project.

"Because mvn eclipse:eclipse will generate eclipse project file
with Dynamic Web Module facet included."


I forgot to refer to the reference.
I solve missing library problem with the help from Ben Hale's comment
at
https://issuetracker.springsource.com/browse/EBR-8

Hussachai


On Jun 21, 12:00 pm, "hussac...@gmail.com" <hussac...@gmail.com>
wrote:

huss...@gmail.com

unread,
Jun 21, 2009, 1:38:16 AM6/21/09
to DAO Fusion
Add some trick for eclipse user.
You may found xml syntax error that mark with
the red color. It's very annoying although it
does not make some troubles. You can disable it by
1) Right click at the project > Properties
2) Go to Validation in the left tree
3) Enable project specific settings and click
Disable All button then press OK button to exit.
4) Go to the files that are marked with red color
Right click at it or the group of them then
Click Validate.

Because of com.anasoft.os.daofusion.sample.hellodao package
is quite long package name and it's not comfortable to view
all but if you choose to increase Project/Package explorer
area, you'll have less workspace are.
To solve this problem
1) Click at the "Down Arrow" at the top right corner in
Project/Package explorer
2) Change the Package Presentation from Flat to Hierachical.


Husscahai


On Jun 21, 12:14 pm, "hussac...@gmail.com" <hussac...@gmail.com>
wrote:
> Fix my own post.
> = 4 = Check out Hello, DAO from trunk ============
> Add step C) for the person who use Subclipse plugin
> After you follow the step B) eclipse will show the
> wizard to create project before start downloading files.
> I recommend you to select Project (Plain project under
> General group) instead of other kind of project.
>
> "Because mvn eclipse:eclipse will generate eclipse project file
> with Dynamic Web Module facet included."
>
> I forgot to refer to the reference.
> I solve missing library problem with the help from Ben Hale's comment
> athttps://issuetracker.springsource.com/browse/EBR-8

Igor Mihalik

unread,
Jun 21, 2009, 7:39:16 AM6/21/09
to DAO Fusion
Hello guys,

I see this conversation very fruitful and I also have some points to
mention:

* We should consider merging this maven/eclipse tutorial regaring
Hello DAO into the project page. Vojto did very good job in terms of
step-by-step guide and it really makes sence to merge it into the
"core" documentation

* The eclipse tips from Husscahai are valuable, I just want to add my
10 cents, eclise has Java Browsing Perspective which IMHO is the best
in terms of project overview. Separation of package, types and members
view makes it easy to navigate through the source code. I highly
recommend every Java developer to use "Java Browsing Perspective"
instead of standard and the most widely used "Java Perspective"

cheers,
igor

Vojtech Szocs

unread,
Jun 21, 2009, 5:15:00 PM6/21/09
to dao-f...@googlegroups.com
Hi guys!

I am happy that things are working now for Hussachai. Thanks for all
comments and dependency fix (we should update Hello DAO pom.xml, maybe
daofusion-parent/pom.xml as well).

I agree with Igor that we should make a tutorial which describes
preparation of the typical development environment (Maven, Ant,
Eclipse + necessary plugins) from all comments in this thread. But
currently our top priority is revision of ref docs so our core
documentation will be up to date after our refactorings (milestone 2
is coming soon). Hussachai if you want you can help us with this
Maven/Ant/Eclipse tutorial (if you have time and motivation) :-)
anyway I am glad that it's working for you now.

Vojtech

huss...@gmail.com

unread,
Jun 22, 2009, 2:27:18 PM6/22/09
to DAO Fusion
Vojtech unfortunately I have only motivation, by the way I will do
that
in the weekend if nothing changes. What about the document format?
I think my tutorial will have plenty of pictures because
I'm not good at English :)

For maven I know I've just learned it in the last few days but
it's very easy and helpful. I don't know why I miss this stuff
for a long time but I'm sure I can write the good document
for the beginner like me.

About your example Hello DAO! I would like to rewrite it with
the plain servlet/jsp and cut off the ajax stuff. I plan to
provide it via my blog (and here if you're interested in)
Because Java has over hundred web frameworks around the world
including
my in house web framework. People have difference experience
and may have a little time. They may don't want to learn the
new thing that they aren't interested in.
As a result, It's good to create the new example with the
basic technology that everyone's already known. So they can
pay attention to the library. By the way, this is just my idea.
For now I will try to understand the example as much as possible.
I think it has many magics in the example that smartgwt/gwt provides.

Hussachai


On Jun 22, 4:15 am, Vojtech Szocs <vojtech.sz...@gmail.com> wrote:
> Hi guys!
>
> I am happy that things are working now for Hussachai. Thanks for all
> comments and dependency fix (we should update Hello DAO pom.xml, maybe
> daofusion-parent/pom.xml as well).
>
> I agree with Igor that we should make a tutorial which describes
> preparation of the typical development environment (Maven, Ant,
> Eclipse + necessary plugins) from all comments in this thread. But
> currently our top priority is revision of ref docs so our core
> documentation will be up to date after our refactorings (milestone 2
> is coming soon). Hussachai if you want you can help us with this
> Maven/Ant/Eclipse tutorial (if you have time and motivation) :-)
> anyway I am glad that it's working for you now.
>
> Vojtech
>
> ...
>
> read more »

Vojtech Szocs

unread,
Jun 23, 2009, 5:08:14 AM6/23/09
to DAO Fusion
Hi, our documentation is generated by maven-site-plugin from Doxia APT
format:
http://maven.apache.org/doxia/format.html

For example, DAO Fusion welcome page looks actually like this:
http://code.google.com/p/daofusion/source/browse/branches/daofusion-site-1.2.x/src/site/apt/index.apt.vm

You can experiment with Maven site generation by checking out
daofusion-site:
http://code.google.com/p/daofusion/source/browse/branches/daofusion-site-1.2.x/

and then execute:
mvn clean site

But first you need to have m2-site-tools installed in your local Maven
repository (it extends maven-site-plugin with various features):
http://m2-site-tools.googlecode.com/files/doxia-macros-1.2b.jar
http://m2-site-tools.googlecode.com/files/stylus-ext-skin-1.2b.jar

mvn install:install-file -Dfile=doxia-macros-1.2b.jar -DgroupId=m2st -
DartifactId=doxia-macros -Dversion=1.2b -Dpackaging=jar
mvn install:install-file -Dfile=stylus-ext-skin-1.2b.jar -
DgroupId=m2st -DartifactId=stylus-ext-skin -Dversion=1.2b -
Dpackaging=jar

After this, "mvn clean site" should work OK.

Feel free to experiment with the APT format. Alternatively you can
create some wiki page on Google Sites and I will convert it to APT.
Plenty of pictures - perfect for tutorial :)

> About your example Hello DAO! I would like to rewrite it with
> the plain servlet/jsp and cut off the ajax stuff. I plan to
> provide it via my blog (and here if you're interested in)
Well we originally planned to do the same thing - plain-old servlet/
JSP, but we had 3 days to do it so we needed some quick UI library and
SmartGWT looked promising (actually we spent 2 days fighting with its
Grid/DataSource API). I agree with you, there should also be some very
basic example and if you want you can do the servlet/JSP version (we
can include it in the "samples" section). Send us link to your blog
too and we will post it on our news page. The main intention of Hello
DAO is the server side, client side and UI logics are just to make it
work and look nice :)

Vojtech
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages