PREWORK


os: centos 6.3, 32 bit

java: jdk 1.6.0_34

maven: 3.0.5

tomcat: 7.0.39

postgresql: 9.2.3-2

eclipse: Juno

PREWORK:

1. install Java

1.1) Run jdk-6u34-linux-i586.bin under home dir. Get /home/***/jdk1.6.0_34

1.2) Config environment for Java, edit ~/.bashrc, add at the end.

export JAVA_HOME=/home/***/jdk1.6.0_34
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

1.3) Source ~/.bashrc, run 'java -version' to confirm environment is good.

2. Install Maven

Maven is very helpful in managing project dependency.

2.1) Unzip apache-maven-3.0.5-bin.zip under ~.

2.2) Config environment, edit ~/.bashrc, make it like:

export M2_HOME=/home/***/apache-maven-3.0.5
export JAVA_HOME=/home/***/jdk1.6.0_34
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$M2_HOME/bin:$PATH

2.3) Source ~/.bashrc, run 'mvn -v' to confirm.

3. Install tomcat

3.1) Unzip apache-tomcat-7.0.39.zip under ~.

I didn't config environment for it, and the file rights are all wrong, like, I cannot run bin/version.sh

4. Install PostgreSQL

4.1) Run postgresql-9.2.3-2-linux.run, GUI showed up.

installation dir:
/opt/PostgreSQL/9.2

Data dir:
/opt/PostgreSQL/9.2/data

password for db superuser (postgres):
________

Server listen on port:
5432

locale to be used by new db cluster:
zh_CN.utf8


4.2) other stuff to install in Stack Builder
choose DB drivers for java to download

pgJDBC installation dir:
/opt/PostgreSQL/pgJDBC

5. Install and config eclipse (keep on-wire)


5.1) unzip eclipse-jee-juno-SR2-linux-gtk.tar.gz under ~.

5.2) install maven integration for eclipse - m2e.

5.3) create a maven project, try to choose quickstart archetype, all catalog failed.

solution:

add a remote catalog: http://tapestry.apache.org, get quickstart archetype

5.4) get an error when hit finishing this archetype, 'The desired archetype does not exist ......'

solution:

tried everything but finally, remove all content under ~/.m2/repository/org/apache/tapestry/quickstart/5.3.6, download a quickstart-5.3.6.jar from web and copy it here.

5.5) Add your favourite tomcat server into eclipse

5.6) run it on server after creating a quickstart project, wait, where is my 'run on server'?

solution:

install m2eclipse-wtp plugin (I missed this plugin when installing m2e, see 5.2) from 'http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/' as 'http://my.oschina.net/feedao/blog/54667' instructed. With this plugin, maven project which contains web application nature would be recognized by eclipse, so tomcat can add it and run it now.