SpringSide 3.3.4 — mini-web — ubuntu

http://lowerthan60.wordpress.com/2011/02/06/springside-3-3-4-mini-web-ubuntu/

1. Download springside3.3.4 source http://www.springside.org.cn/download.php

2. Extract the source package to file system. e.g. /home/bacon/works/spring-side-3.3.4

3. Under the spring side source folder, execute

view sourceprint?
1 mvn clean install -Dmaven.test.skip=true

2   

3 mvn eclipse:clean eclipse:eclipse
4.  Go into the mini-web folder. e.g. /home/bacon/works/spring-side-3.3.4/examples/mini-web

5. Update “pom.xml”

comment out the “h2″ related section in “properties”, enable “mysql” section

6. Update “application.properties” under /home/bacon/works/spring-side-3.3.4/examples/mini-web/src/main/resources

comment out “h2″ related section, enable “mysql” section.

Note: originally the database name in mysql jdbc.url is “mini-web”, but “-” is not supported in mysql database name convention. So we should remove the “-” from the database name just like “miniweb”

7. Update “default-data.xml”. It’s used to init data for mini-web

go to /home/bacon/works/spring-side-3.3.4/examples/mini-web/src/test/resources/data, open “default-data.xml“, change the fields name to lower case. e.g. change “ACCT_AUTHORITY” to “acct_authority“

Originally the fields name in “default-data.xml” is upper case. But the table name in mysql schema file is lower case. So we need to keep them consistent. Otherwise database initialize will be failed

/home/bacon/works/spring-side-3.3.4/examples/mini-web/src/main/resources/sql/mysql/schema.sql

8. Ensure that the installed mysql support utf8

check “default-character-set = utf8” is under [client], [mysqld-safe] and [mysqld]. Also make sure “init_connect=’SET NAMES utf8‘” is under [mysqld-safe] if there is

9. Update “build.xml” of mini-web, go to /home/bacon/works/spring-side-3.3.4/examples/mini-web/bin, update “build.xml”

comment out “h2″ related section, enable “mysql” section

10. Create database “miniweb” into mysql.

login into to mysql : mysql -u  root -p

create database miniweb;

11. Init database, under /home/bacon/works/spring-side-3.3.4/examples, execut

ensure “maven-ant-task.jar” is in ant/lib folder

ant -f bin/build.xml init-db

the tables and init data for mini-web should be created into “miniweb” in mysql database

12. Add tomcat maven plugin into mini-web “pom.xml”

view sourceprint?
1 <!-- tomcat plugin -->

2   

3 <plugin> 

4   

5 <groupId>org.codehaus.mojo</groupId> 

6   

7 <artifactId>tomcat-maven-plugin</artifactId> 

8   

9 </plugin>
13. Start tomcat for test:

mvn tomcat:run

14. Generate project file for eclipse. Go into “/home/bacon/works/spring-side-3.3.4/examples/mini-web“. Execute “mvn eclipse:clean eclipse:eclipse” if there is no “.project” file over there.

15. Start eclipse.

“File->Import->General->Existing Projects into Workspace“

Browse to folder “/home/bacon/works/spring-side-3.3.4/modules“, click “OK”. There are 3 projects will be shown in the “Projects:” list box. Select all of them and then press “Finish” to import them into eclipse

Again browse to folder “/home/bacon/works/spring-side-3.3.4/examples/mini-web“. Import mini-web into eclipse

16. Install maven plugin for eclipse

“Help->Install New Software“, enter “http://m2eclipse.sonatype.org/sites/m2e” and then click “Add”. Select the plugin and follow the instruction to install maven plugin for eclipse

17. Enable maven dependency support for “mini-web”. Right-click on “mini-web” project, select “Maven->Enable Dependency Management“

18. Run Configuration for “mini-web”. Right-click on “mini-web” project. Select “Maven Build”, then click “New” button on left-top. Enter the name e.g. “miniweb-maven“, specify “Base directory” by click “Browse Workspace…” then select “mini-web”, specify the goals “tomcat:run”

19. Run “mini-web” on tomcat. Select “mini-web” then click “Run” drop down list, select “miniweb-maven” which has been configured at step 18.

20. Debug “mini-web” on tomcat. Select “mini-web” then click “Debug” drop down list, select “miniweb-maven” which has been configured at step 18.

你可能感兴趣的:(spring,maven,Web,mysql,ubuntu)