1 从svn地址下载项目应用到本地磁盘
E:\CMS\icntv-cmsV2.0.1
2 maven服务设置:需要在User Settints中配置:C:\Users\shili\.m2\settings.xml
3利用myeclipse工具导入maven项目:
import->Exitsing Maven Projects
Root Directory 选择:
E:\CMS\icntv-cmsV2.0.1\yst-cms-webapp\pom.xml
3根据maven更新jar包:
maven4myeclipse
4 下载jetty6.x版本,因为项目应用用的是mysql数据库,且数据源的配置是用的maven之前的工具包,只有6.X之前的版本才能支持
例如class类:org.mortbay.jetty.plus.naming.Resource
5 数据库配置文件放在:E:\CMS\icntv-cmsV2.0.1\yst-cms-webapp\src\main\webapp\WEB-INF\jetty-env.xml 此文件在发布到jetty容器后会自动加载到服务当中,不需要另外配置数据库连接,配置文件内容如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="cmsDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/CMS</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/cms?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="cisdataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/CIS</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/cis?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true
</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="drmsDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/DRMS</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/drms?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true
</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="pubDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/PUB</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/pub?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true
</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="epgDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/EPG</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/epg?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="cdnDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/CDN</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/cdn?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="prepDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/PREP</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/prep?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
<New id="edataDataSource" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/EDATA</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.75.204:3306/edata?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true</Set>
<Set name="username">root</Set>
<Set name="password">root</Set>
</New>
</Arg>
</New>
</Configure>
6 搭建项目时遇到的问题
1)找不到jar包
2)更改web context-root 路径指向,由于目录下面有两个web.xml文件,发布服务不正确,需要更改:context-root