<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>what is the RIA?  just it…&#124;&#124;咖啡兔</title>
	<atom:link href="http://www.wsria.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wsria.com</link>
	<description>我们要的就是RIA……Let&#039;s do it now.</description>
	<lastBuildDate>Fri, 03 Feb 2012 18:53:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Linux(Ubuntu)环境安装配置Nginx+Dokuwiki</title>
		<link>http://www.wsria.com/archives/1613</link>
		<comments>http://www.wsria.com/archives/1613#comments</comments>
		<pubDate>Fri, 03 Feb 2012 18:53:27 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[工具]]></category>
		<category><![CDATA[dokuwiki]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1613</guid>
		<description><![CDATA[前言 这几天一直忙着公司项目的整合，添加了一些配置文件可以结合Maven灵活控制项目（编译、打包），最终能达到项目结构的拆合自如；连续的修改产生了很多配置项，也没有很清楚的描述这样对以后势必造成不好理解，所以还是为公搭建一个WIKI服务（个人已有）。 我的博客和WIKI是放在一起的，使用的apache作为web服务器，公司的服务器上安装的是nginx和apache，但是apache仅仅只开放了svn服务端口，而且以后的项目都是用nginx作为静态代理和负载均衡，不废话了，action。 一、准备工作 已Ubuntu 10.04 LTS为例： 安装nginx和php-cgi就不说了，参考本博客的配置 二、配置nginx 下载Dokuwiki：http://www.splitbrain.org/projects/dokuwiki，然后解压到/usr/share/dokuwiki目录中 创建文件：/etc/nginx/conf.d/dokuwiki.conf sudo vi /etc/nginx/conf.d/dokuwiki.conf 复制以下内容到/etc/nginx/conf.d/dokuwiki.conf 这里要明确第11行的root是dokuwiki目录的上一级，也就是/usr/share，参考：Nginx虚拟目录 启动php-fastcgi： sudo service php-fastcgi start 现在访问：http://localhost/dokuwiki/install.php，按照提示安装就可以了。 参考资料： Ubuntu配置ngnix+phpmyadmin http://www.dokuwiki.org/install:nginx 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: Linux(Ubuntu)环境安装配置Nginx+Dokuwiki<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1540&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Ubuntu配置ngnix+phpmyadmin</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1015&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">最新消息：本站的WIKI开通了 wiki.wsria.cn</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1529&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Ubuntu安装ORACLE-XE</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Linux下springside4快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Linux下springside3快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h3>前言</h3>
<p>这几天一直忙着公司项目的整合，添加了一些配置文件可以结合Maven灵活控制项目（编译、打包），最终能达到项目结构的拆合自如；连续的修改产生了很多配置项，也没有很清楚的描述这样对以后势必造成不好理解，所以还是为公搭建一个WIKI服务（个人已有）。</p>
<p>我的博客和WIKI是放在一起的，使用的apache作为web服务器，公司的服务器上安装的是<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/nginx" title="查看 nginx 中所有文章" target="_blank">nginx</a></span>和apache，但是apache仅仅只开放了svn服务端口，而且以后的项目都是用<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/nginx" title="查看 nginx 中所有文章" target="_blank">nginx</a></span>作为静态代理和负载均衡，不废话了，action。</p>
<h3>一、准备工作</h3>
<p>已Ubuntu 10.04 LTS为例：</p>
<p>安装<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/nginx" title="查看 nginx 中所有文章" target="_blank">nginx</a></span>和php-cgi就不说了，<a href="#refers">参考本博客的配置</a></p>
<h3>二、配置nginx</h3>
<p>下载Doku<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/wiki" title="查看 wiki 中所有文章" target="_blank">wiki</a></span>：<a href="http://www.splitbrain.org/projects/dokuwiki" target="_blank">http://www.splitbrain.org/projects/dokuwiki</a>，然后解压到/usr/share/<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/dokuwiki" title="查看 dokuwiki 中所有文章" target="_blank">dokuwiki</a></span>目录中
</p>
<p>创建文件：/etc/nginx/conf.d/<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/dokuwiki" title="查看 dokuwiki 中所有文章" target="_blank">dokuwiki</a></span>.conf</p>
<blockquote><p>sudo vi /etc/nginx/conf.d/<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/dokuwiki" title="查看 dokuwiki 中所有文章" target="_blank">dokuwiki</a></span>.conf</p></blockquote>
<p>复制以下内容到/etc/nginx/conf.d/doku<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/wiki" title="查看 wiki 中所有文章" target="_blank">wiki</a></span>.conf</p>
<pre class="brush: plain; highlight: [11]; title: ; notranslate">
server{
	 #listen 80;
	 index index.html index.php doku.php;
	 #make sure a global root is defined here
	 #(...)

	access_log /var/log/dokuwiki.access_log;
	error_log /var/log/dokuwiki.error_log;

	 location ~ ^/dokuwiki/.*\.php {
	 	 root           /usr/share;
		 include        fastcgi_params;
		 fastcgi_pass   127.0.0.1:9000;
		 fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
	 }

	 # serve static files
	 location ~ ^/dokuwiki/lib/  {
		 root	 /usr/share;
		 expires 30d;
	 }

	 location ~ ^/dokuwiki/conf/ { deny all; }
	 location ~ ^/dokuwiki/data/ { deny all; }
	 location ~ /\.ht            { deny all; }
 }
</pre>
<blockquote><p>
这里要明确第11行的root是dokuwiki目录的上一级，也就是/usr/share，参考：<a href="http://sudone.com/nginx/nginx_alias.html" target="_blank">Nginx虚拟目录</a>
</p></blockquote>
<p>启动php-fastcgi：</p>
<blockquote><p>sudo service php-fastcgi start</p></blockquote>
<p>现在访问：http://localhost/dokuwiki/install.php，按照提示安装就可以了。</p>
<h3 id="refers">参考资料：</h3>
<ul>
<li><a href="http://www.wsria.com/archives/1540" target="_blank">Ubuntu配置ngnix+phpmyadmin</a></li>
<li><a href="http://www.dokuwiki.org/install:nginx" target="_blank">http://www.dokuwiki.org/install:nginx</a></li>
</ul>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1613">Linux(Ubuntu)环境安装配置Nginx+Dokuwiki</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1613&type=feed" alt="" /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1540&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Ubuntu配置ngnix+phpmyadmin</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1015&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">最新消息：本站的WIKI开通了 wiki.wsria.cn</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1529&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Ubuntu安装ORACLE-XE</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Linux下springside4快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1613">
                        <font size="-1"  style="line-height: 1.65em; font-size: 12px !important;">Linux下springside3快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1613/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux下springside4快捷脚本（quick-start、generate-project）</title>
		<link>http://www.wsria.com/archives/1605</link>
		<comments>http://www.wsria.com/archives/1605#comments</comments>
		<pubDate>Fri, 09 Dec 2011 02:24:25 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[个人作品]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[SpringSide]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1605</guid>
		<description><![CDATA[一、前言 尝鲜的同学得意了，特意编写了在linux下面运行的快捷脚本shell，对于springside3的脚本请访问：Linux下springside3快捷脚本（quick-start、generate-project） generate-project脚本在springside3和springside4一样，请参考上面的地址！ 二、quick-start.sh 复制以下脚本保存为quick-start.sh #!/bin/bash # 脚本名称：quick-start.sh # 作者：咖啡兔 # 博客：http://www.wsria.com # 日期：2011-12-09 # Email:yanhonglei[at]gmail.com echo [INFO] 确保默认JDK版本为JDK6.0及以上版本,已配置JAVA_HOME. echo [INFO] 如不能连接Maven官方网站, 修改本文件去掉下面一行的注释. #设置临时变量 MAVEN_OPTS="$MAVEN_OPTS -XX:MaxPermSize=128m" SS_DIR=$(dirname $(cd ${0%/*} &#038;&#038; echo $PWD/${0##*/})) ANT="$SS_DIR/tools/ant/apache-ant-1.8.2/bin/ant" #cd $(dirname `which $0`)意思是进入shell所在的目录 cd $SS_DIR if &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1605">继续阅读 &#187;</a></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Linux下springside3快捷脚本（quick-start、generate-project）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Linux下springside3快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工欲善其事必先利其器–Java Web快速开发框架–Springside" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1188&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工欲善其事必先利其器–Java Web快速开发框架–Springside</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1079&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1004&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/19/2204439.png" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐：国内第一本Maven书籍——《Maven实战》" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1480&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/06/7742332.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐：国内第一本Maven书籍——《Maven实战》</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h3>一、前言</h3>
<p>尝鲜的同学得意了，特意编写了在<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/linux" title="查看 linux 中所有文章" target="_blank">linux</a></span>下面运行的快捷<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e8%84%9a%e6%9c%ac" title="查看 脚本 中所有文章" target="_blank">脚本</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/shell" title="查看 shell 中所有文章" target="_blank">shell</a></span>，对于springside3的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e8%84%9a%e6%9c%ac" title="查看 脚本 中所有文章" target="_blank">脚本</a></span>请访问：<a href="http://www.wsria.com/archives/1580" title="Linux下springside3快捷脚本（quick-start、generate-project）" target="_blank">Linux下springside3快捷脚本（quick-start、generate-project）</a></p>
<p>
generate-project脚本在springside3和springside4一样，请参考上面的地址！
</p>
<h3>二、quick-start.sh</h3>
<blockquote><p>
复制以下脚本保存为quick-start.sh
</p></blockquote>
<p><span id="more-1605"></span></p>
<pre>
#!/bin/bash

# 脚本名称：quick-start.sh
# 作者：咖啡兔
# 博客：http://www.wsria.com
# 日期：2011-12-09
# Email:yanhonglei[at]gmail.com

echo [INFO] 确保默认JDK版本为JDK6.0及以上版本,已配置JAVA_HOME.
echo [INFO] 如不能连接Maven官方网站, 修改本文件去掉下面一行的注释.

#设置临时变量
MAVEN_OPTS="$MAVEN_OPTS -XX:MaxPermSize=128m"
SS_DIR=$(dirname $(cd ${0%/*} &#038;&#038; echo $PWD/${0##*/}))
ANT="$SS_DIR/tools/ant/apache-ant-1.8.2/bin/ant"

#cd $(dirname `which $0`)意思是进入shell所在的目录
cd $SS_DIR
if [ -d "tools/ant/apache-ant-1.8.2/" ]; then
	ANT="$SS_DIR/tools/ant/apache-ant-1.8.2/bin/ant"
fi

echo [Step 1] 安装SpringSide4 所有modules, examples项目及mini項目生成模板到本地Maven仓库, 生成Eclipse项目文件.
mvn clean install -Pmodules -Dmaven.test.skip=true
mvn eclipse:clean eclipse:eclipse

echo [Step 2] 启动H2数据库.
cd tools/h2
gnome-terminal -e "mvn exec:java" &#038;
cd ../../

echo [Step 3] 为Mini-Service 初始化数据库, 启动Jetty.
cd examples/mini-service
ant -f bin/db/build.xml init-db
gnome-terminal -e "mvn -Djetty.port=8083 jetty:run" &#038;
cd ../../

echo [Step 4] 为Mini-Web 初始化数据库, 启动Jetty.
cd examples/mini-web
ant -f bin/db/build.xml init-db
gnome-terminal -e "mvn -Djetty.port=8084 jetty:run" &#038;
cd ../../

echo [Step 5] 为Showcase 生成Eclipse项目文件, 编译, 打包, 初始化数据库, 启动Jetty.
cd examples/showcase
ant -f bin/db/build.xml init-db
gnome-terminal -e "mvn -Djetty.port=8085 jetty:run" &#038;
cd ../../

echo [INFO] SpringSide4.0 快速启动完毕.
echo [INFO] 可访问以下演示网址:
echo [INFO] http://localhost:8083/mini-service
echo [INFO] http://localhost:8084/mini-web
echo [INFO] http://localhost:8085/showcase
</pre>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1605">Linux下springside4快捷脚本（quick-start、generate-project）</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1605&type=feed" alt="" /><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Linux下springside3快捷脚本（quick-start、generate-project）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Linux下springside3快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工欲善其事必先利其器–Java Web快速开发框架–Springside" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1188&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工欲善其事必先利其器–Java Web快速开发框架–Springside</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1079&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1004&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/19/2204439.png" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐：国内第一本Maven书籍——《Maven实战》" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1480&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/06/7742332.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐：国内第一本Maven书籍——《Maven实战》</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1605/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下springside3快捷脚本（quick-start、generate-project）</title>
		<link>http://www.wsria.com/archives/1580</link>
		<comments>http://www.wsria.com/archives/1580#comments</comments>
		<pubDate>Sat, 13 Aug 2011 12:59:56 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[工具]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[SpringSide]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1580</guid>
		<description><![CDATA[一、交代背景 使用Springside（一下简称SS）有段时间了，之前一直都是用windows开发，正好SS提供了很方便一键安装（quick-start）和一键生成（generate-project）脚本（bat格式）；前段时间全面切换环境到Ubuntu，因为培训新员工的缘故需要给他们讲解SS（因为我们用SS作为公司的基础架构），所以我在本地需要操作SS，但是脚本仅限于Windows，好在这段时间看了一部分Bash的书籍，所以决定自己根据bat脚本修改一个bash的脚本。 二、quick-start.sh 复制以下脚本保存为quick-start.sh #!/bin/bash # 脚本名称：quick-start.sh # 作者：咖啡兔 # 博客：http://www.wsria.com # 日期：2011-08-13 # 有更好的建议或写法请联系：yanhonglei[at]gmail.com echo [INFO] 确保默认JDK版本为JDK6.0及以上版本,已配置JAVA_HOME. echo [INFO] 如不能连接Maven官方网站, 修改本文件去掉下面一行的注释. #设置临时变量 MVN=mvn ANT=ant MAVEN_OPTS="$MAVEN_OPTS -XX:MaxPermSize=128m" SS_DIR=$(dirname $(cd ${0%/*} &#038;&#038; echo $PWD/${0##*/})) ANT="$SS_DIR/tools/ant/apache-ant-1.8.1/bin/ant" #cd $(dirname `which $0`)意思是进入shell所在的目录 cd $SS_DIR &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1580">继续阅读 &#187;</a></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Linux下springside4快捷脚本（quick-start、generate-project）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Linux下springside4快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1079&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工欲善其事必先利其器–Java Web快速开发框架–Springside" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1188&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工欲善其事必先利其器–Java Web快速开发框架–Springside</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐：国内第一本Maven书籍——《Maven实战》" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1480&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/06/7742332.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐：国内第一本Maven书籍——《Maven实战》</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1004&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/19/2204439.png" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h3>一、交代背景</h3>
<p>使用Springside（一下简称SS）有段时间了，之前一直都是用windows开发，正好SS提供了很方便一键安装（quick-start）和一键生成（generate-project）<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e8%84%9a%e6%9c%ac" title="查看 脚本 中所有文章" target="_blank">脚本</a></span>（bat格式）；前段时间全面切换环境到Ubuntu，因为培训新员工的缘故需要给他们讲解SS（因为我们用SS作为公司的基础架构），所以我在本地需要操作SS，但是<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e8%84%9a%e6%9c%ac" title="查看 脚本 中所有文章" target="_blank">脚本</a></span>仅限于Windows，好在这段时间看了一部分Bash的书籍，所以决定自己根据bat脚本修改一个bash的脚本。</p>
<h3>二、quick-start.sh</h3>
<blockquote><p>
复制以下脚本保存为quick-start.sh
</p></blockquote>
<p><span id="more-1580"></span></p>
<pre>
#!/bin/bash

# 脚本名称：quick-start.sh
# 作者：咖啡兔
# 博客：http://www.wsria.com
# 日期：2011-08-13
# 有更好的建议或写法请联系：yanhonglei[at]gmail.com

echo [INFO] 确保默认JDK版本为JDK6.0及以上版本,已配置JAVA_HOME.
echo [INFO] 如不能连接Maven官方网站, 修改本文件去掉下面一行的注释.

#设置临时变量
MVN=mvn
ANT=ant
MAVEN_OPTS="$MAVEN_OPTS -XX:MaxPermSize=128m"
SS_DIR=$(dirname $(cd ${0%/*} &#038;&#038; echo $PWD/${0##*/}))
ANT="$SS_DIR/tools/ant/apache-ant-1.8.1/bin/ant"

#cd $(dirname `which $0`)意思是进入shell所在的目录
cd $SS_DIR
if [ -d "tools/ant/apache-ant-1.8.1/" ]; then
	ANT="$SS_DIR/tools/ant/apache-ant-1.8.1/bin/ant"
fi
echo Maven命令为$MVN
echo Ant命令为$ANT

echo [Step 1] 复制tools/maven/central-repository 到 ~/.m2/repository
cp -r "tools/maven/central-repository" ~/.m2/repository

echo [Step 2] 安装SpringSide3 所有modules, examples项目及mini項目生成模板到本地Maven仓库, 生成Eclipse项目文件.
$MVN clean install -Dmaven.test.skip=true
$MVN eclipse:clean eclipse:eclipse

echo [Step 3] 启动H2数据库.
cd tools/h2
$MVN exec:java &#038;
cd ../../
# 等待5秒钟，因为遇到过问题：启动下面的web应用的时候H2还未启动完成，如果机器性能低请增加等待时间
sleep 5

echo [Step 4] 为Mini-Service 初始化数据库, 启动Jetty.
cd examples/mini-service
$ANT -f bin/build.xml init-db
$MVN -Djetty.port=8083 jetty:run &#038;
cd ../../

echo [Step 5] 为Mini-Web 初始化数据库, 启动Jetty.
cd examples/mini-web
$ANT -f bin/build.xml init-db
$MVN -Djetty.port=8084 jetty:run &#038;
cd ../../

echo [Step 6] 为Showcase 生成Eclipse项目文件, 编译, 打包, 初始化数据库, 启动Jetty.
cd examples/showcase
$ANT -f bin/build.xml init-db
$MVN -Djetty.port=8085 jetty:run &#038;
cd ../../

echo [INFO] SpringSide3.0 快速启动完毕.
echo [INFO] 可访问以下演示网址:
echo [INFO] http://localhost:8083/mini-service
echo [INFO] http://localhost:8084/mini-web
echo [INFO] http://localhost:8085/showcase
</pre>
<blockquote><p>不要忘记为脚本添加执行权限：</p>
<pre>
chmod a+x generate-project.sh
</pre>
</blockquote>
<hr/>
<blockquote><p><strong>脚本不足</strong>：<br />
启动数据库和3个演示项目之后按Ctrl+C不能停止进程，因为进程都是在后台运行的，脚本运行完成后使用：</p>
<pre>ps -e | grep java</pre>
<p>然后结束这些java进程，或者使用：</p>
<pre>sudo netstat -tulnp | grep java</pre>
<p>根据端口结束进程：</p>
<pre>kill -9 xxx</pre>
</blockquote>
<blockquote><p>目前能力有限，如果有更好的办法解决上面这个问题欢迎回复完善此文章！</p></blockquote>
<p>如果出现以下错误信息，请下载maven-ant-tasks.jar，<a href="http://maven.apache.org/ant-tasks/download.html" target="_blank">下载地址</a>：</p>
<pre>
Buildfile: /home/kafeitu/work/sources/springside/springside-3.3.4/examples/mini-web/bin/build.xml

BUILD FAILED
/home/kafeitu/work/sources/springside/springside-3.3.4/examples/mini-web/bin/build.xml:4: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:dependencies
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any
<presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet

This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
        -/home/kafeitu/work/tools/apache/ant/apache-ant-1.8.2/lib
        -/home/kafeitu/.ant/lib
        -a directory added on the command line with the -lib argument

Total time: 0 seconds
</pre>
<h3>三、generate-project.sh</h3>
<p>这个比较简单，请复制以下脚本保存到generate-project.sh</p>
<pre>
echo [INFO] 确保已用mvn install安裝tools/maven/archetype中的mini-web项目模板
gpdir=generated-projects
cd $(dirname `which $0`)
if [ ! -d "$gpdir" ]; then
	mkdir $gpdir
fi
cd $gpdir
mvn archetype:generate -DarchetypeCatalog=local
</pre>
<blockquote><p>不要忘记为脚本添加执行权限：</p>
<pre>
chmod a+x generate-project.sh
</pre>
</blockquote>
<h3>四、结束语</h3>
<p>好了，两个简单的脚本OK了，希望能帮助你解决问题，期待高手的意见和参与！</p>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1580">Linux下springside3快捷脚本（quick-start、generate-project）</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1580&type=feed" alt="" /><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Linux下springside4快捷脚本（quick-start、generate-project）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1605&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Linux下springside4快捷脚本（quick-start、generate-project）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1079&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Springside3.3.3报错：java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工欲善其事必先利其器–Java Web快速开发框架–Springside" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1188&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工欲善其事必先利其器–Java Web快速开发框架–Springside</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐：国内第一本Maven书籍——《Maven实战》" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1480&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/06/7742332.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐：国内第一本Maven书籍——《Maven实战》</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1004&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1580">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/19/2204439.png" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Eclipse+Maven+WTP+Tomcat不能Run On Server其中一个原因</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1580/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI及其插件在企业环境的应用总结</title>
		<link>http://www.wsria.com/archives/1549</link>
		<comments>http://www.wsria.com/archives/1549#comments</comments>
		<pubDate>Sun, 24 Jul 2011 08:04:19 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[前端技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[总结]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1549</guid>
		<description><![CDATA[一、博文背景 使用jQuery差不多3年了，开始只是简单的应用，后来发现了官网开发的jQuery UI；从去年的一个项目开始使用jQuery UI作为主要的UI插件，选择jQuery UI的主要原因是因为需要使用jqGrid这个插件，而这个插件又使用了jQuery UI的主题;再者jQuery UI提供主题的自定义，这样对于一些喜欢不同风格的客户来说就比较容易切换自己喜欢的主题了。 写这篇博文的想法就是因为基于jQuery UI开发了两套系统，并且都运行正常，而且客户的反应也不错，所以整理以下和大家分享我的经验，同时也和正在使用的童鞋交流，希望起到抛砖引玉的作用。 二、jQuery UI基础 官网：http://jqueryui.com/ 演示：http://jqueryui.com/demos/ 下载：http://jqueryui.com/download 在线主题自定义：http://jqueryui.com/themeroller/ 在我们的系统中主要使用了Dialog、Tab、Button、Autocomplete等功能，下面会对于使用过程中遇到的问题进行列举： IE下面Dialog高度问题血的教训呀……问题描述：我们的系统都是用JSP开发的，而且定义了一个global.jsp文件用于引入一些每个页面都需要用到的常量之类的属性，当然包括公共设置的JS代码，例如JSP代码： &#60;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&#62; &#60;%@ include file="/common/global.jsp" %&#62; &#60;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&#62; &#60;html&#62; 输出的HTML代码如下： &#60;script type="text/javascript"&#62; // &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1549">继续阅读 &#187;</a></p><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="[转][推荐]15 个 JavaScript Web UI 库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F974&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/02/20547097.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[转][推荐]15 个 JavaScript Web UI 库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery 1.4 正式版发布啦(14 Days of jQuery)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F772&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/19/2205099.png" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery 1.4 正式版发布啦(14 Days of jQuery)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery入门教程PPT" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F333&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery入门教程PPT</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery1.4 API 区别与更新中文版" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F796&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery1.4 API 区别与更新中文版</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐：2009 年度最佳 jQuery 插件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F733&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/30/15174680.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐：2009 年度最佳 jQuery 插件</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h3>一、博文背景</h3>
<p>使用<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jquery" title="查看 jQuery 中所有文章" target="_blank">jQuery</a></span>差不多3年了，开始只是简单的应用，后来发现了官网开发的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jquery" title="查看 jQuery 中所有文章" target="_blank">jQuery</a></span> <span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/ui" title="查看 UI 中所有文章" target="_blank">UI</a></span>；从去年的一个项目开始使用jQuery <span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/ui" title="查看 UI 中所有文章" target="_blank">UI</a></span>作为主要的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/ui" title="查看 UI 中所有文章" target="_blank">UI</a></span>插件，选择jQuery UI的主要原因是因为需要使用jqGrid这个插件，而这个插件又使用了jQuery UI的主题;再者jQuery UI提供主题的自定义，这样对于一些喜欢不同风格的客户来说就比较容易切换自己喜欢的主题了。<br />
写这篇博文的想法就是因为基于jQuery UI开发了两套系统，并且都运行正常，而且客户的反应也不错，所以整理以下和大家分享我的经验，同时也和正在使用的童鞋交流，希望起到抛砖引玉的作用。</p>
<h3>二、jQuery UI基础</h3>
<blockquote><p>
<strong>官网</strong>：<a href="http://jqueryui.com/" target="_blank">http://jqueryui.com/</a><br />
<strong>演示</strong>：<a href="http://jqueryui.com/demos/" target="_blank">http://jqueryui.com/demos/</a><br />
<strong>下载</strong>：<a href="http://jqueryui.com/download" target="_blank">http://jqueryui.com/download</a><br />
<strong>在线主题自定义</strong>：<a href="http://jqueryui.com/themeroller/" target="_blank">http://jqueryui.com/themeroller/</a>
</p></blockquote>
<p>在我们的系统中主要使用了Dialog、Tab、Button、Autocomplete等功能，下面会对于使用过程中遇到的问题进行列举：<br />
<span id="more-1549"></span></p>
<ul>
<li><strong>IE下面Dialog高度问题</strong><br/>血的教训呀……<br/><strong>问题描述</strong>：我们的系统都是用JSP开发的，而且定义了一个global.jsp文件用于引入一些每个页面都需要用到的常量之类的属性，当然包括公共设置的JS代码，例如JSP代码：
<pre>
&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt;
&lt;%@ include file="/common/global.jsp" %&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
</pre>
<p>输出的HTML代码如下：</p>
<pre>
&lt;script type="text/javascript"&gt;
	// 服务器日期
	var systemDate = new Date(2011, 6, 22);
	var strSystemDate = "2011-07-22";
&lt;/script&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
</pre>
<p>问题出来了，按照上面的输出在IE下面会导致对话框的高度属性无效，再Firefox下正常;所以一直以来我都以为是jQuery UI对IE支持的BUG，后来实验后得知在一些html包含的元素必须严格按照标准书写，否则IE不能兼容而其他非IE可以兼容，修改后的代码如下：</p>
<pre>
&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;%@ include file="/common/global.jsp" %&gt;
</pre>
<p>这样输出的结果就是：</p>
<pre>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;script type="text/javascript"&gt;
	// 服务器日期
	var systemDate = new Date(2011, 6, 22);
	var strSystemDate = "2011-07-22";
&lt;/script&gt;
</pre>
<p>这样IE和Firefox打开的对话框高度就一致了……IE的容错性不高呀，不过这样也严格要求了我们的代码规整性，谨记不要犯类似错误。
</li>
<li><strong>为Dialog的Button添加图标(Icon)</strong>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * 为dialog中的button设置icon
 * @param {Object} options
 */</span>
setIcons<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.ui-dialog-buttonpane'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'button:contains('</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">')'</span><span style="color: #009900;">&#41;</span>
		.<span style="color: #660066;">button</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		    icons<span style="color: #339933;">:</span> options<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>调用方式：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#div_1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dialog</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">open</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqui</span>.<span style="color: #660066;">dialog</span>.<span style="color: #660066;">button</span>.<span style="color: #660066;">setIcons</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			上传<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> primary<span style="color: #339933;">:</span> <span style="color: #3366CC;">'ui-icon-arrowthick-1-n'</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			关闭<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> primary<span style="color: #339933;">:</span> <span style="color: #3366CC;">'ui-icon-cancel'</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
</ul>
<p>具体每个组件怎么使用看官网的demo和文档吧，还是比较详细的。</p>
<h3>三、jQuery UI扩展</h3>
<blockquote><p>
DEMO：<a href="http://quasipartikel.at/multiselect/">http://quasipartikel.at/multiselect/</a>
</p></blockquote>
<p>另外一个类似的Multiselect插件：</p>
<blockquote><p>
DEMO：<a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/">http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/</a>
</p></blockquote>
<p>这两个插件功能差不多，都可以过滤数据，而且完全使用jQuery UI主题，根据应用环境自己选择。</p>
<blockquote><p>
还有一些扩展再jQuery UI官网的SVN的分支中，地址：<a href="http://jquery-ui.googlecode.com/svn/branches">http://jquery-ui.googlecode.com/svn/branches</a><br />
希望能从中发现你需要的功能。
</p></blockquote>
<h3>四、jQuery UI扩展-jqGrid</h3>
<blockquote><p>一个功能强大的grid插件，一个吸引我使用jQuery UI的插件，一个能满足日常需要的插件，一个特别想推荐给大家的插件，它就是jqGrid。<br/><br />
<strong>官网</strong>：<a href="http://www.trirand.com/blog/">http://www.trirand.com/blog/</a><br />
<strong>DEMO</strong>：<a href="http://www.trirand.com/blog/jqgrid/jqgrid.html">http://www.trirand.com/blog/jqgrid/jqgrid.html</a><br />
<strong>WIKI</strong>：<a href="http://www.trirand.com/jqgridwiki/doku.php">http://www.trirand.com/jqgridwiki/doku.php</a>
</p></blockquote>
<p>使用jqGrid有段时间了，经常遇到有些童鞋问我具体怎么用，说实话jqGrid的DEMO和WIKI文档写的很清楚，而且有示例代码，所以对于怎么使用我就不做代码搬运工了，我讲的是经验。</p>
<h3>五、jQuery UI扩展-jqGrid高级应用(从正在运行项目中提取)</h3>
<ol>
<li><strong>列表高度和宽度自动调整</strong><br />
这个话题是经常有人问到的，因为jqGrid的列表高度和宽度是可以自定义的，所以要做到可以充满整个窗口或者iframe，并且最重要的是可以根据窗口的调整自动设置grid的高度和宽度，下面列出我的配置。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//-- 浏览器工具 --//</span>
$.<span style="color: #660066;">common</span>.<span style="color: #660066;">browser</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// 检测是否是IE浏览器</span>
	isIE <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> _uaMatch <span style="color: #339933;">=</span> $.<span style="color: #660066;">uaMatch</span><span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">userAgent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> _browser <span style="color: #339933;">=</span> _uaMatch.<span style="color: #660066;">browser</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_browser <span style="color: #339933;">==</span> <span style="color: #3366CC;">'msie'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">// 检测是否是chrome浏览器</span>
	isChrome <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> _uaMatch <span style="color: #339933;">=</span> $.<span style="color: #660066;">uaMatch</span><span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">userAgent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> _browser <span style="color: #339933;">=</span> _uaMatch.<span style="color: #660066;">browser</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_browser <span style="color: #339933;">==</span> <span style="color: #3366CC;">'webkit'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">// 检测是否是Firefox浏览器</span>
	isMozila <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> _uaMatch <span style="color: #339933;">=</span> $.<span style="color: #660066;">uaMatch</span><span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">userAgent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> _browser <span style="color: #339933;">=</span> _uaMatch.<span style="color: #660066;">browser</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_browser <span style="color: #339933;">==</span> <span style="color: #3366CC;">'mozilla'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">/**
 * 改变窗口大小的时候自动根据iframe大小设置jqGrid列表宽度和高度
 * 参数说明：{
 * 		enableAutoResize : 是否开启自动高度和宽度调整开关
 * 		dataGrid : jqGrid数据列表的ID
 * 		callback : 计算完dataGrid需要的高度和宽度后的回调函数
 * 		width : 默认为iframe的宽度，如果指定则设置为指定的宽度
 * 		height : 默认为iframe的高度，如果指定则设置为指定的高度
 * 		beforeAutoResize : 窗口大小调整时自动设置之前
 * 		afterAutoResize : 窗口大小调整时自动设置之后
 * }
 */</span>
$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">autoResize</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> defaults <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
		enableAutoResize <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		beforeAutoResize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
		afterAutoResize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
	options <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> defaults<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// 第一次调用</span>
	<span style="color: #003366; font-weight: bold;">var</span> size <span style="color: #339933;">=</span> getWidthAndHeigh<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">isFunction</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">callback</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		options.<span style="color: #660066;">callback</span><span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setToolbarHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// 窗口大小改变的时候</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">enableAutoResize</span> <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">isFunction</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">beforeAutoResize</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			options.<span style="color: #660066;">beforeAutoResize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		window.<span style="color: #000066;">onresize</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> size <span style="color: #339933;">=</span> getWidthAndHeigh<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">dataGrid</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">jqGrid</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'setGridHeight'</span><span style="color: #339933;">,</span> size.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">jqGrid</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'setGridWidth'</span><span style="color: #339933;">,</span> size.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			setToolbarHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">isFunction</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">afterAutoResize</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				options.<span style="color: #660066;">afterAutoResize</span><span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// 根据浏览器不同设置工具栏的高度</span>
	<span style="color: #003366; font-weight: bold;">function</span> setToolbarHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// 根据浏览器不同设置工具栏的高度</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">browser</span>.<span style="color: #660066;">isIE</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> options.<span style="color: #660066;">toolbarHeight</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">&amp;&amp;</span> options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">top</span>.<span style="color: #660066;">ie</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#t_list'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">top</span>.<span style="color: #660066;">ie</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">bottom</span> <span style="color: #339933;">&amp;&amp;</span> options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">bottom</span>.<span style="color: #660066;">ie</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#tb_list'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">bottom</span>.<span style="color: #660066;">ie</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// 获取iframe大小</span>
	<span style="color: #003366; font-weight: bold;">function</span> getWidthAndHeigh<span style="color: #009900;">&#40;</span>resize<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> hasToolbar <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>options.<span style="color: #660066;">toolbar</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">false</span> <span style="color: #339933;">:</span> options.<span style="color: #660066;">toolbar</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hasToolbar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> toolbarType <span style="color: #339933;">=</span> options.<span style="color: #660066;">toolbar</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>toolbarType<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'请设置工具栏的属性，toolbar ： [true, [top, both]]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> iframeHeight <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>options.<span style="color: #660066;">height</span> <span style="color: #339933;">?</span> document.<span style="color: #660066;">documentElement</span>.<span style="color: #660066;">clientHeight</span> <span style="color: #339933;">:</span> options.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> iframeWidth <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>options.<span style="color: #660066;">width</span> <span style="color: #339933;">?</span> document.<span style="color: #660066;">documentElement</span>.<span style="color: #660066;">clientWidth</span> <span style="color: #339933;">:</span> options.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// chrome</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">browser</span>.<span style="color: #660066;">isChrome</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hasToolbar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>toolbarType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'top'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">;</span>
					iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">128</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>toolbarType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'both'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">14</span><span style="color: #339933;">;</span>
					iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">140</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">13</span><span style="color: #339933;">;</span>
				iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">87</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #006600; font-style: italic;">// firefox</span>
		<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">browser</span>.<span style="color: #660066;">isMozila</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hasToolbar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>toolbarType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'top'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span>
					iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">122</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>toolbarType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'both'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">12</span><span style="color: #339933;">;</span>
					iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">145</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span>
				iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">89</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span> 
		<span style="color: #006600; font-style: italic;">// IE</span>
		<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hasToolbar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>toolbarType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'top'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">browser</span>.<span style="color: #660066;">isIE</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> options.<span style="color: #660066;">toolbarHeight</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">&amp;&amp;</span> options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">top</span>.<span style="color: #660066;">ie</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
							<span style="color: #006600; font-style: italic;">// 减去jqGrid的t_list默认高度和IE的兼容高度</span>
							iframeHeight <span style="color: #339933;">-=</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">toolbarHeight</span>.<span style="color: #660066;">top</span>.<span style="color: #660066;">ie</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">21</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">15</span><span style="color: #339933;">;</span>
						<span style="color: #009900;">&#125;</span>
					<span style="color: #009900;">&#125;</span>
					iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">128</span><span style="color: #339933;">;</span>
					iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">15</span><span style="color: #339933;">;</span>
					setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #006600; font-style: italic;">// 设置上方的toolbar</span>
						$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#t_'</span> <span style="color: #339933;">+</span> options.<span style="color: #660066;">dataGrid</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>iframeWidth <span style="color: #339933;">-</span> <span style="color: #CC0000;">11</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>toolbarType <span style="color: #339933;">==</span> <span style="color: #3366CC;">'both'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">14</span><span style="color: #339933;">;</span>
					iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">151</span><span style="color: #339933;">;</span>
					setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #006600; font-style: italic;">// 设置上方的toolbar</span>
						$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#t_'</span> <span style="color: #339933;">+</span> options.<span style="color: #660066;">dataGrid</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>iframeWidth <span style="color: #339933;">-</span> <span style="color: #CC0000;">11</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				iframeWidth <span style="color: #339933;">-=</span> <span style="color: #CC0000;">12</span><span style="color: #339933;">;</span>
				iframeHeight <span style="color: #339933;">-=</span> <span style="color: #CC0000;">88</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>width<span style="color: #339933;">:</span> iframeWidth<span style="color: #339933;">,</span> height<span style="color: #339933;">:</span> iframeHeight<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>调用方式：</p>
<pre>
$(function() {
	// 自动根据窗口大小改变数据列表大小
	$.common.plugin.jqGrid.autoResize({
		dataGrid: '#list',
		toolbar: [true, 'top'],
		callback: listDatas
	});

});

function listDatas(size) {
	$("#list").jqGrid({
		....
		height: size.height,
		width: size.width
		....
	});
}
</pre>
<p>这样在窗口调整大小的时候会自动设置grid的高度和宽度。<br />
可以查看实际应用中的<a href="http://code.google.com/p/wsria/source/browse/trunk/wsria-demo/src/main/webapp/js/module/demo/jqgrid/datalibrary-list.js">例子</a>
</li>
<li><strong>如果可以尽量使用继承式配置</strong><br/><br />
使用继承方式的目的主要是修改一处配置整个项目都可以起到作用，除非特殊情况才覆盖公共的配置。例如刚刚的<a href="http://code.google.com/p/wsria/source/browse/trunk/wsria-demo/src/main/webapp/js/module/demo/jqgrid/datalibrary-list.js">例子</a>，提供我的例子：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * 加载列表
 * 
 * @return
 */</span>
<span style="color: #003366; font-weight: bold;">function</span> listDatas<span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#list&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">jqGrid</span><span style="color: #009900;">&#40;</span>
	$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">settings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>size<span style="color: #339933;">:</span> size<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		url<span style="color: #339933;">:</span> moduleAction <span style="color: #339933;">+</span> <span style="color: #3366CC;">'!list.action'</span><span style="color: #339933;">,</span>
		rownumbers<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		rownumWidth<span style="color: #339933;">:</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span>
		toolbar<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'both'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		rowList<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">30</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">40</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		pagerpos<span style="color: #339933;">:</span> <span style="color: #3366CC;">'center'</span><span style="color: #339933;">,</span>
		colNames<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'工号'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'姓名'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'密码'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'电子邮件'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'部门'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'角色'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        colModel<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'employeeId'</span><span style="color: #339933;">,</span>
			width<span style="color: #339933;">:</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span>
			align<span style="color: #339933;">:</span> <span style="color: #3366CC;">'center'</span><span style="color: #339933;">,</span>
			searchoptions <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    			sopt <span style="color: #339933;">:</span> $.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">text</span>
    		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			search<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        .......<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		caption<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;用户管理&quot;</span><span style="color: #339933;">,</span>
		editurl<span style="color: #339933;">:</span> moduleAction <span style="color: #339933;">+</span> <span style="color: #3366CC;">'!save.action'</span><span style="color: #339933;">,</span>
		gridComplete<span style="color: #339933;">:</span> $.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">gridComplete</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'list'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">jqGrid</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'navGrid'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'#pager'</span><span style="color: #339933;">,</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">pager</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		add<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
		edit<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		del<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
		view<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
		search<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	<span style="color: #006600; font-style: italic;">// edit options</span>
    $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">form</span>.<span style="color: #660066;">edit</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		width <span style="color: #339933;">:</span> <span style="color: #CC0000;">450</span><span style="color: #339933;">,</span>
		editCaption<span style="color: #339933;">:</span> <span style="color: #3366CC;">'修改'</span><span style="color: #339933;">,</span>
		beforeShowForm<span style="color: #339933;">:</span> commonBeforeShowForm<span style="color: #339933;">,</span>
    	beforeSubmit<span style="color: #339933;">:</span> beforeSubmit
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// add options</span>
    <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
    <span style="color: #006600; font-style: italic;">// delete options</span>
    $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">form</span>.<span style="color: #660066;">remove</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		url<span style="color: #339933;">:</span> moduleAction <span style="color: #339933;">+</span> <span style="color: #3366CC;">'!delete.action'</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// search optios</span>
	$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">form</span>.<span style="color: #660066;">search</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		closeAfterSearch<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">// view options</span>
	$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">form</span>.<span style="color: #660066;">view</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		beforeShowForm<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>formid<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    		$.<span style="color: #660066;">common</span>.<span style="color: #660066;">plugin</span>.<span style="color: #660066;">jqGrid</span>.<span style="color: #660066;">navGrid</span>.<span style="color: #660066;">showAllField</span><span style="color: #009900;">&#40;</span>formid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
</ol>
<h3>六、结束语</h3>
<p>以上列出了经常使用的一些配置和问题解决办法，所以抱着详细学习插件使用方法的你失望了，因为各个插件的官网均有详细的文档和DEMO演示；</p>
<blockquote><p>以上的代码在<a href="http://code.google.com/p/wsria/source/browse/trunk/wsria-demo/src/main/webapp/js/common/common.js"><strong>这里</strong></a>可以找到，你可以从中提取，使用JSON扩展方式布局。<br/><br />
基本上在我的每个页面都会引入<a href="http://code.google.com/p/wsria/source/browse/trunk/wsria-demo/src/main/webapp/js/common/common.js">common.js</a>，大家可以整理出一个自己的common.js
</p></blockquote>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1549">jQuery UI及其插件在企业环境的应用总结</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1549&type=feed" alt="" /><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">兔子向您推荐：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="[转][推荐]15 个 JavaScript Web UI 库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F974&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/02/20547097.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[转][推荐]15 个 JavaScript Web UI 库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery 1.4 正式版发布啦(14 Days of jQuery)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F772&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/19/2205099.png" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery 1.4 正式版发布啦(14 Days of jQuery)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery入门教程PPT" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F333&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery入门教程PPT</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="jQuery1.4 API 区别与更新中文版" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F796&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">jQuery1.4 API 区别与更新中文版</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐：2009 年度最佳 jQuery 插件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.wsria.com%2Farchives%2F733&from=http%3A%2F%2Fwww.wsria.com%2Farchives%2F1549">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/30/15174680.jpg" width="96px" height="96px" /><br />
                        <font size="-1"  style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐：2009 年度最佳 jQuery 插件</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1549/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu配置ngnix+phpmyadmin</title>
		<link>http://www.wsria.com/archives/1540</link>
		<comments>http://www.wsria.com/archives/1540#comments</comments>
		<pubDate>Sat, 16 Jul 2011 04:17:42 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[工具]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1540</guid>
		<description><![CDATA[一、背景 操作系统：Ubuntu11.04-X86 nginx: 1.04 目录位于：/usr/local/nginx 之前我是使用apache作为phpmyadmin的web服务器，后来因为一个项目的环境是nginx配置下来感觉很简单而且业界对nginx评价又比较高所以才转移到nginx; 二、安装配置过程 如果还枚安装过nginx、php、phpmyadmin环境的话，请使用下面的命令安装： sudo apt-get install nginx mysql-server php5-cgi php5-mysql phpmyadmin 如果和我的环境一样的话，那么安装 sudo apt-get install php5-cgi 创建php-fastcgi脚本： sudo vi /etc/init.d/php-fastcgi 插入如下脚本： #!/bin/bash BIND=127.0.0.1:9000 USER=www-data PHP_FCGI_CHILDREN=15 PHP_FCGI_MAX_REQUESTS=1000 PHP_CGI=/usr/bin/php-cgi PHP_CGI_NAME=`basename $PHP_CGI` PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1540">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h3>一、背景</h3>
<p>操作系统：Ubuntu11.04-X86<br />
<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/nginx" title="查看 nginx 中所有文章" target="_blank">nginx</a></span>: 1.04 目录位于：/usr/local/<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/nginx" title="查看 nginx 中所有文章" target="_blank">nginx</a></span><br />
之前我是使用apache作为<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/phpmyadmin" title="查看 phpmyadmin 中所有文章" target="_blank">phpmyadmin</a></span>的web服务器，后来因为一个项目的环境是nginx配置下来感觉很简单而且业界对nginx评价又比较高所以才转移到nginx;</p>
<h3>二、安装配置过程</h3>
<p>如果还枚安装过nginx、php、<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/phpmyadmin" title="查看 phpmyadmin 中所有文章" target="_blank">phpmyadmin</a></span>环境的话，请使用下面的命令安装：</p>
<pre>
sudo apt-get install nginx mysql-server php5-cgi php5-mysql phpmyadmin
</pre>
<p>如果和我的环境一样的话，那么安装 </p>
<pre>
sudo apt-get install php5-cgi
</pre>
<p>创建php-fastcgi脚本：</p>
<pre>
sudo vi /etc/init.d/php-fastcgi
</pre>
<p>插入如下脚本：<br />
<span id="more-1540"></span></p>
<pre>
#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000

PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0

start() {
      echo -n "Starting PHP FastCGI: "
      start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}
stop() {
      echo -n "Stopping PHP FastCGI: "
      killall -q -w -u $USER $PHP_CGI
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}

case "$1" in
    start)
      start
  ;;
    stop)
      stop
  ;;
    restart)
      stop
      start
  ;;
    *)
      echo "Usage: php-fastcgi {start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL
</pre>
<p>然后设置php-fastcgi随系统启动：</p>
<pre>
sudo chmod +x /etc/init.d/php-fastcgi
sudo service php-fastcgi start
sudo update-rc.d php-fastcgi defaults
</pre>
<p>配置nginx的phpmyadmin：</p>
<pre>
sudo mkdir -p /usr/local/nginx/conf/server/localhost
sudo vi /usr/local/nginx/conf/server/localhost/phpmyadmin.conf
</pre>
<p>插入如下片段：</p>
<pre>
server{
	listen 80;
	server_name phpmyadmin;
	access_log /var/log/phpmyadmin.access_log;
	error_log /var/log/phpmyadmin.error_log;

	location / {
	  root /usr/share/phpmyadmin;
	  index index.php;
	}

	location ~ \.php$ {
	    fastcgi_pass    127.0.0.1:9000;
	    fastcgi_index   index.php;
	    fastcgi_param   SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
	    include         fastcgi_params;
	}
}
</pre>
<blockquote><p>其中的日志文件位置和fastcgi_pass中的端口根据自己的环境修改</p></blockquote>
<p>在nginx.conf中include phpmyadmin配置：</p>
<pre>
sudo vi /usr/local/nginx/conf/nginx.conf
</pre>
<p>在最后一个大括号之前插入：</p>
<pre>
include /usr/local/nginx/conf/server/localhost/phpmyadmin.conf;
</pre>
<p>启动nginx:</p>
<pre>
kafeitu@kafeitu-nb:~$ sudo /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
kafeitu@kafeitu-nb:~$ sudo /usr/local/nginx/sbin/nginx
</pre>
<p>打开/etc/hosts，找到127.0.0.1   localhost然后再最后面加入phpmyadmin保存退出</p>
<pre>
127.0.0.1   localhost phpmyadmin
</pre>
<p>现在访问：http://phpmyadmin/ ，开始享受吧……</p>
<p>参考资料：<a href="http://joneslee85.wordpress.com/2010/02/28/howto-nginx-php5-mysql-phpmyadmin-ubuntu-shortest-setup/" target="_blank">Howto nginx + php5 + mysql + phpmyadmin + ubuntu shortest setup</a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1540">Ubuntu配置ngnix+phpmyadmin</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1540&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1540/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ubuntu安装ORACLE-XE</title>
		<link>http://www.wsria.com/archives/1529</link>
		<comments>http://www.wsria.com/archives/1529#comments</comments>
		<pubDate>Fri, 15 Jul 2011 07:52:49 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[工具]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1529</guid>
		<description><![CDATA[最近开发环境迁移到了Linux的发行版Ubuntu，但是目前正在开发的系统是使用的Oracle数据库，从网上找了一对资料都是很麻烦的，又是乱码又是一堆的配置，后来google到原来有一个ubuntu版本的…… 环境说明 操作系统：Ubuntu 11.04 X86 一、安装Oracle-Xe Oracle 为 Ubuntu 用户设立了专门的 apt 源服务器，运行下面的命令： sudo apt-add-repository "deb http://oss.oracle.com/debian unstable main non-free" 这时不要急于更新，还要将该源服务器的公钥添加到本地密钥库中，先下载公钥 ： sudo wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle 下载完成后，添加到密钥库中 sudo apt-key add RPM-GPG-KEY-oracle 现在我们可以执行更新的命令了 sudo apt-get update 更新完毕候从仓库中搜索一下oracle相关的软件： sudo apt-cache search oracle 看到三个我们需要的结果： oracle-xe &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1529">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>最近开发环境迁移到了Linux的发行版Ubuntu，但是目前正在开发的系统是使用的Oracle数据库，从网上找了一对资料都是很麻烦的，又是乱码又是一堆的配置，后来google到原来有一个<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/ubuntu" title="查看 ubuntu 中所有文章" target="_blank">ubuntu</a></span>版本的……</p>
<h3>环境说明</h3>
<p>操作系统：Ubuntu 11.04 X86</p>
<h3>一、安装Oracle-Xe</h3>
<p>Oracle 为 Ubuntu 用户设立了专门的 apt 源服务器，运行下面的命令：</p>
<pre>
sudo apt-add-repository "deb http://oss.oracle.com/debian unstable main non-free"
</pre>
<p>这时不要急于更新，还要将该源服务器的公钥添加到本地密钥库中，先下载公钥 ：</p>
<pre>
sudo wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle
</pre>
<p><span id="more-1529"></span><br />
下载完成后，添加到密钥库中</p>
<pre>
sudo apt-key add RPM-GPG-KEY-oracle
</pre>
<p>现在我们可以执行更新的命令了</p>
<pre>
sudo apt-get update
</pre>
<p>更新完毕候从仓库中搜索一下<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/oracle" title="查看 oracle 中所有文章" target="_blank">oracle</a></span>相关的软件：</p>
<pre>
sudo apt-cache search oracle
</pre>
<p>看到三个我们需要的结果：</p>
<pre>
oracle-xe - Oracle Database 10g Express Western European Edition
oracle-xe-client - Oracle Client 10g Express Edition
oracle-xe-universal - Oracle Database 10g Express Universal Edition
</pre>
<p>因为是开发需要所以我安装了<b><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/oracle" title="查看 oracle 中所有文章" target="_blank">oracle</a></span>-xe</b>，运行命令：</p>
<pre>
sudo apt-get install libaio1
sudo apt-get install oracle-xe
</pre>
<p>到此安装完成，下面的配置才是关键的。</p>
<h3>二、配置Oracle</h3>
<p>在/etc/profile中添加<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/oracle" title="查看 oracle 中所有文章" target="_blank">oracle</a></span>相关配置：</p>
<pre>
sudo vi /etc/profile
</pre>
<p>添加如下内容：</p>
<pre>
# oracle settings
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_SID=XE
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=/usr/lib/oracle
</pre>
<p>在配置的过程中遇到了问题，因为我参考的资料没有设置<strong>ORACLE_SID</strong>所以导致数据不能访问，安装后默认的SID是<strong>XE</strong>；</p>
<h3>三、配置TNS</h3>
<pre>
sudo vi /usr/lib/oracle/tnsnames.ora
</pre>
<p>添加如下内容：</p>
<pre>
orcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )
</pre>
<p>其中SERVICE_NAME和ORACLE_SID一致，orcl可以自定义</p>
<h3>四、Ubuntu下sqlplus上下光标键乱码解决方法</h3>
<p>遇到如题所述的问题时，可以这样解决该问题：<br />
1、安装插件： sudo apt-get install rlwrap<br />
2、在~/.bashrc中添加：alias sqlplus=&#8217;rlwrap sqlplus&#8217;<br />
3、重新键入sqlplus命令即可尽情享用上下左右光标键了</p>
<h3>五、中文乱码问题解决</h3>
<p>在~/.bashrc中添加：</p>
<pre>
export NLS_LANG=american_america.utf8
</pre>
<h3>六、代替win下面的plsql developer工具</h3>
<p>在linux下面可以使用oracle官方开发的sql developer，下载地址：<br />
<a href="http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html" target="_blank">下载sql developer</a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1529">Ubuntu安装ORACLE-XE</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1529&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1529/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Server 2008 R2 X64安装Oracle 10g R2后不能创建数据库问题解决办法</title>
		<link>http://www.wsria.com/archives/1519</link>
		<comments>http://www.wsria.com/archives/1519#comments</comments>
		<pubDate>Sun, 26 Jun 2011 04:12:46 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[解决方案]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1519</guid>
		<description><![CDATA[Windows Server 2008 R2 X64安装Oracle 10g R2后不能创建数据库问题解决办法<p class="read-more"><a href="http://www.wsria.com/archives/1519">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h3>一、背景交代</h3>
<p>客户刚刚到的一台新服务器，型号为：IBM X3850，自带的操作系统为：Windows Server 2008 R2 X64；需要安装版本为10.2.0.4版本的Oracle数据库。</p>
<h3>二、遇到问题</h3>
<p>找到Oracle提供的安装光盘后安装数据库一路next，到了最后<strong>创建数据库</strong>的时候遇到了问题，进度停止不前，如下图：<br />
<a href="http://www.wsria.com/wp-content/uploads/2011/06/oracle-create-db.png" rel="lightbox[1519]" title="oracle创建数据库时等待状态--停滞不前"><img src="http://www.wsria.com/wp-content/uploads/2011/06/oracle-create-db.png" alt="oracle创建数据库时等待状态--停滞不前" title="oracle创建数据库时等待状态--停滞不前" width="575" height="423" class="alignright size-full wp-image-1522" /></a><br/><br />
查看trace.log内容如下：<br />
<span id="more-1519"></span></p>
<pre>
[main] [14:46:52:122] [CommandLineArguments.process:563]  CommandLineArguments->process: number of arguments = 32
[main] [14:46:52:122] [CommandLineArguments.process:738]  CommandLineArguments->process: Create Database argument is specified
[main] [14:46:52:122] [CommandLineArguments.process:910]  CommandLineArguments->process: template Name argument is specified
[main] [14:46:52:122] [CommandLineArguments.process:960]  CommandLineArguments->process: db name argument is specified
[main] [14:46:52:122] [CommandLineArguments.process:3074]  CommandLineArguments->process: in Operation Type is Creation/GenerateScripts Mode condition
[main] [14:46:52:137] [CommandLineArguments.process:3298]  CommandLineArguments->process: Successfully process command line arguments
[main] [14:46:52:855] [Host.checkOPS:2055]  Inside checkOPS
[main] [14:46:52:855] [Host.checkOPS:2067]  Trying to check cluster existence
[main] [14:46:52:902] [Library.getInstance:97]  Created instance of Library.
[main] [14:46:52:902] [Library.load:197]  Loading orauts.dll...
[main] [14:46:52:902] [Library.load:203]  oracleHome D:\oracle\product\10.2.0\db_1
[main] [14:46:52:902] [sPlatform.isHybrid:63]  osName=Windows Vista osArch=amd64 rc=false
[main] [14:46:52:902] [Library.load:223]  Loading  library D:\oracle\product\10.2.0\db_1\bin\orauts.dll
[main] [14:46:52:902] [Library.load:247]  Loaded library D:\oracle\product\10.2.0\db_1\bin\orauts.dll from path=
D:\oracle\product\10.2.0\db_1\bin
[main] [14:46:52:902] [Library.load:197]  Loading MSVCRT.dll...
[main] [14:46:52:902] [Library.load:203]  oracleHome D:\oracle\product\10.2.0\db_1
[main] [14:46:52:902] [sPlatform.isHybrid:63]  osName=Windows Vista osArch=amd64 rc=false
[main] [14:46:52:902] [Library.load:223]  Loading  library D:\oracle\product\10.2.0\db_1\bin\MSVCRT.dll
[main] [14:46:52:902] [Library.load:247]  Loaded library D:\oracle\product\10.2.0\db_1\bin\MSVCRT.dll from path=
D:\oracle\product\10.2.0\db_1\bin
[main] [14:46:52:902] [Library.load:197]  Loading orawsec10.dll...
[main] [14:46:52:902] [Library.load:203]  oracleHome D:\oracle\product\10.2.0\db_1
[main] [14:46:52:902] [sPlatform.isHybrid:63]  osName=Windows Vista osArch=amd64 rc=false
[main] [14:46:52:902] [Library.load:223]  Loading  library D:\oracle\product\10.2.0\db_1\bin\orawsec10.dll
[main] [14:46:52:902] [Library.load:247]  Loaded library D:\oracle\product\10.2.0\db_1\bin\orawsec10.dll from path=
D:\oracle\product\10.2.0\db_1\bin
[main] [14:46:52:902] [Library.load:197]  Loading orasrvm10.dll...
[main] [14:46:52:902] [Library.load:203]  oracleHome D:\oracle\product\10.2.0\db_1
[main] [14:46:52:902] [sPlatform.isHybrid:63]  osName=Windows Vista osArch=amd64 rc=false
[main] [14:46:52:902] [Library.load:223]  Loading  library D:\oracle\product\10.2.0\db_1\bin\orasrvm10.dll
[main] [14:46:52:902] [Library.load:247]  Loaded library D:\oracle\product\10.2.0\db_1\bin\orasrvm10.dll from path=
D:\oracle\product\10.2.0\db_1\bin
[main] [14:46:52:902] [Version.isPre10i:189]  isPre10i.java: Returning FALSE
[main] [14:46:52:902] [WindowsSystem.regKeyExists:1006]  WindowsSystem.regKeyExists: mainkey= HKEY_LOCAL_MACHINE subkey = Software\Oracle\Ocr
[main] [14:46:53:104] [WindowsSystem.getCSSConfigType:1163]  configType=null
[main] [14:46:53:104] [Host.checkOPS:2073]  cluster existence:false
[main] [14:46:53:104] [Host.checkOPS:2111]  Cluster installed=false
[main] [14:46:53:260] [InitParamHandler.endElement:506]  CustomSGA flag: false
[main] [14:46:53:260] [InitParamHandler.endElement:507]  Database Type: MULTIPURPOSE
[main] [14:46:53:260] [InitParamHandler.endElement:508]  Mem Percentage: 40
[main] [14:46:53:260] [InitParamHandler.endElement:526]  distributing Memory: 13737443328
[main] [14:46:53:260] [MemoryCalculator.calculateMemory:122]  Setting SGA to MAX_SGA 1610612736
[main] [14:46:53:276] [StorageAttributes.setAttribute:232]  IN threadID:1 group#=1
[main] [14:46:53:276] [StorageAttributes.setAttribute:232]  IN threadID:1 group#=2
[main] [14:46:53:276] [StorageAttributes.setAttribute:241]  Current threadID=1
[main] [14:46:53:276] [StorageAttributes.setAttribute:248]  Current threadID=1 ==> redoGroups[0]=1
[main] [14:46:53:276] [StorageAttributes.setAttribute:258]  vRedoGroups:[1]
[main] [14:46:53:276] [StorageAttributes.setAttribute:288]  setAttribute: bExists=false
[main] [14:46:53:276] [StorageAttributes.setAttribute:232]  IN threadID:1 group#=3
[main] [14:46:53:276] [StorageAttributes.setAttribute:241]  Current threadID=1
[main] [14:46:53:276] [StorageAttributes.setAttribute:248]  Current threadID=1 ==> redoGroups[0]=1
[main] [14:46:53:276] [StorageAttributes.setAttribute:248]  Current threadID=1 ==> redoGroups[1]=2
[main] [14:46:53:276] [StorageAttributes.setAttribute:258]  vRedoGroups:[1, 2]
[main] [14:46:53:276] [StorageAttributes.setAttribute:288]  setAttribute: bExists=false
[main] [14:46:53:276] [TemplateManager.parseCloneTemplate:1477]  See for any transportable datafiles in TemplateManager.....
[main] [14:46:53:276] [TemplateManager.isInstallTemplate:2178]  Selected Template by user:=General Purpose
[main] [14:46:53:276] [TemplateManager.isInstallTemplate:2185]  The Message Id to be searched:=GENERAL_PURPOSE
[main] [14:46:53:276] [TemplateManager.parseCloneTemplate:1489]  create new clone data file for tp file.......
[main] [14:46:53:276] [Host.setupOIDCommandlineParameters:7184]  setupOIDCommandlineParameters:
[main] [14:46:53:276] [Host.setupOIDCommandlineParameters:7185]  m_regWithdirService: false
[main] [14:46:53:276] [Host.setupOIDCommandlineParameters:7186]  m_unregWithdirService: false
[main] [14:46:53:276] [Host.setupOIDCommandlineParameters:7187]  m_updateDirService: false
[main] [14:46:53:276] [Verifier.processRawConfigFile:3523]  StorageType == 0
[main] [14:46:53:276] [Verifier.setOradataDest:4349]  setOradataDest:dfDest=D:\oracle\product\10.2.0\oradata
[main] [14:46:53:276] [TemplateManager.updateDatafileDestination:1957]  updateDatafiles:datafileDir=D:\oracle\product\10.2.0\oradata
[main] [14:46:53:276] [TemplateManager.updateDatafileDestination:2103]  From template, RedoLogGrName=1
[main] [14:46:53:307] [TemplateManager.updateDatafileDestination:2118]  new file name redo01.log
[main] [14:46:53:307] [TemplateManager.updateDatafileDestination:2103]  From template, RedoLogGrName=2
[main] [14:46:53:307] [TemplateManager.updateDatafileDestination:2118]  new file name redo02.log
[main] [14:46:53:307] [TemplateManager.updateDatafileDestination:2103]  From template, RedoLogGrName=3
[main] [14:46:53:307] [TemplateManager.updateDatafileDestination:2118]  new file name redo03.log
[main] [14:46:53:307] [ProgressOnlyHost.performOperation:162]  processRawConfigFile=false
[main] [14:46:53:307] [Verifier.validateTemplate:1629]  StorageType == 0
[main] [14:46:53:307] [ProgressOnlyHost.performOperation:178]  validateTemplate=true
[main] [14:46:53:307] [OracleHome.isRacEnabled:149]  bRacOn = false
[main] [14:46:53:323] [Verifier.validateTemplate:1629]  StorageType == 0
[main] [14:46:53:323] [Verifier.calculateCloneDatafilePathsAndSizes:2951]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:323] [Verifier.calculateCloneDatafilePathsAndSizes:2951]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:323] [Verifier.calculateCloneDatafilePathsAndSizes:2951]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:323] [Verifier.calculateCloneDatafilePathsAndSizes:2951]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:323] [Verifier.calculateCloneDatafilePathsAndSizes:2951]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:338] [Verifier.calculateRedoLogGroupFileSizes:3083]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:338] [Verifier.calculateRedoLogGroupFileSizes:3083]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:338] [Verifier.calculateRedoLogGroupFileSizes:3083]  canonicalPath=D:\oracle\product\10.2.0\
[main] [14:46:53:338] [Verifier.getControlfFileSizes:3001]  No. of Control files:=3
[main] [14:46:53:463] [Host.executeSteps:4044]  Executing steps....
[main] [14:46:53:463] [Host.setUpForOperation:2920]  setUpForOperation: Mode = 128
[main] [14:46:53:479] [Host.executeSteps:4186]  setupForOperation returned: true
[main] [14:46:53:479] [Host.createStepSQLInterface:5948]  sid =orcl
[main] [14:46:53:494] [SQLEngine.initialize:242]  Execing SQLPLUS/SVRMGR process...
[main] [14:46:53:494] [SQLEngine.initialize:270]  m_bReaderStarted: false
[main] [14:46:53:494] [SQLEngine.initialize:274]  Starting Reader Thread...
[Thread-4] [14:46:53:713] [StepContext$ModeRunner.run:2478]  ---- Progress Needed:=true
[Thread-4] [14:46:53:822] [BasicStep.execute:202]  Executing Step : CLONE_DB_CREATION_RMAN_RESTORE
[Thread-4] [14:46:53:822] [StepErrorHandler.setFatalErrors:322]  setting Fatal Error: ORA-01092
[Thread-4] [14:46:53:822] [StepErrorHandler.setFatalErrors:322]  setting Fatal Error: ORA-01034
[Thread-4] [14:46:53:822] [StepErrorHandler.setFatalErrors:322]  setting Fatal Error: ORA-03114
[Thread-4] [14:46:53:822] [StepErrorHandler.setFatalErrors:322]  setting Fatal Error: ORA-12560
[Thread-4] [14:46:53:822] [StepErrorHandler.setIgnorableErrors:250]  setting Ignorable Error: ORA-01109
[Thread-4] [14:46:53:822] [BasicStep.configureSettings:304]  messageHandler being set=null
[Thread-4] [14:46:53:822] [BasicStep.execute:202]  Executing Step : INSTANCE_CREATION
[Thread-4] [14:46:53:822] [BasicStep.configureSettings:304]  messageHandler being set=null
[Thread-4] [14:46:53:838] [InitParamAttributes.sortParams:3532]  m_sortOn:-1 sortOn:4
[Thread-4] [14:46:53:884] [OracleHome.isRacEnabled:149]  bRacOn = false
[Thread-4] [14:46:53:884] [Host.noEntryinOratab:5115]  Check made for oratab arg passed............
[Thread-4] [14:46:53:884] [Oradim.getAddEntryCommand:353]  AddEntry=[D:\oracle\product\10.2.0\db_1\bin\oradim.exe, -new, -sid, ORCL, -startmode, manual, -spfile]
[Thread-4] [14:46:54:976] [Oradim.getEditEntryCommand:422]  getEditEntry cmd=[D:\oracle\product\10.2.0\db_1\bin\oradim.exe, -edit, -sid, ORCL, -startmode, auto, -srvcstart, system]
[Thread-4] [14:46:55:164] [Oradim.addSidToRegistry:871]  oracleHomeKey: SOFTWARE\ORACLE\KEY_OraDb10g_home1
[Thread-4] [14:46:55:226] [BasicStep.configureSettings:304]  messageHandler being set=oracle.sysman.assistants.util.UIMessageHandler@6f27f79d
[Thread-4] [14:46:55:226] [CloneRmanRestoreStep.executeImpl:217]  Instance Creation went fine..........
[Thread-4] [14:46:55:226] [CloneRmanRestoreStep.executeImpl:224]  db_recovery_file_dest=D:\oracle\product\10.2.0\flash_recovery_area
[Thread-4] [14:46:55:226] [CloneRmanRestoreStep.executeImpl:227]  db_recovery_file_dest_size=2147483648
[Thread-4] [14:46:56:115] [SQLEngine.setSpool:1750]  old Spool  = null
[Thread-4] [14:46:56:115] [SQLEngine.setSpool:1751]  Setting Spool  = D:\oracle\product\10.2.0\db_1\cfgtoollogs\dbca\orcl\CloneRmanRestore.log
[Thread-4] [14:46:56:115] [SQLEngine.setSpool:1752]  Is spool appendable? --> true
[Thread-4] [14:46:56:115] [CloneRmanRestoreStep.executeImpl:320]  starting with pfile=D:\oracle\product\10.2.0\admin\orcl\pfile\init.ora
</pre>
<p>开始怀疑是操作系统的问题，然后我在vmware虚拟机上安装Windows Server 2008 R2 X64然后安装数据库顺利通过，之后让管理员安装企业版的系统，再安装orace问题还是存在。</p>
<h3>三、解决办法</h3>
<p>因为是正版的就打电话给<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/oracle" title="查看 oracle 中所有文章" target="_blank">oracle</a></span>咨询，几经周折后得知需要安装补丁，编号：<strong>8202632</strong>，这个补丁需要的安装办法：</p>
<ul>
<li>安装数据库的时候不要选择“创建数据库”选项</li>
<li>安装完成后安装补丁<strong>8202632</strong>，注意这个步骤在安装的时候选择安装数据库的时候home路径（例如C:\<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/oracle" title="查看 oracle 中所有文章" target="_blank">oracle</a></span>\product\10.2.0\db_1）</li>
<li>补丁安装完成之后再运行“Database Configuration Assistant”创建数据库。</li>
</ul>
<p><strong>补丁8202632下载地址：</strong><a href="ftp://updates.oracle.com/8202632/p8202632_10205_MSWIN-x86-64.zip" target="_blank">ftp://updates.oracle.com/8202632/p8202632_10205_MSWIN-x86-64.zip</a></p>
<h3>四、延伸问题及解决办法</h3>
<p>如果遇到“<strong>EM不能启动</strong>”的问题请另外打补丁解决，编号：8350262<br/><br />
下载地址：<a href="http://download.csdn.net/source/3045207">http://download.csdn.net/source/3045207</a></p>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1519">Windows Server 2008 R2 X64安装Oracle 10g R2后不能创建数据库问题解决办法</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1519&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1519/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>转：Maven实战（一）——坐标规划</title>
		<link>http://www.wsria.com/archives/1497</link>
		<comments>http://www.wsria.com/archives/1497#comments</comments>
		<pubDate>Mon, 13 Dec 2010 13:30:00 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[后台技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[转载]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[推荐]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1497</guid>
		<description><![CDATA[坐标是什么？为什么要规划？ 坐标是Maven最基本的概念，它就像每个构件的身份证号码，有了它我们就可以在数以千万计的构件中定位任何一个我们感兴趣的构件。举个最简单的例子，如果没有坐标，使用JUnit的时候，用户就需要去下载依赖jar包，用依赖的方式，简单配置使用如junit:junit:4.8.2就可以了。这里第一个junit是groupId，第二个junit是artifactId，4.8.2是version。 Maven的很多其他核心机制都依赖于坐标，其中最显著的就是仓库和依赖管理。对于仓库来说，有了坐标就知道在什么位置存储构件的内容，例如junit:junit:4.8.2就对应仓库中的路径/junit/junit/4.8.2/junit-4.8.2.pom和/junit/junit/4.8.2/junit-4.8.2.jar这样的文件，读者可以直接访问中央仓库地址看到这样的仓库布局，或者浏览本地仓库目录~/.m2/repository/以获得直观的体验。 依赖的配置也是完全基于坐标的，例如： &#60;dependency&#62; &#60;groupId&#62;junit&#60;/groupId&#62; &#60;artifactId&#62;junit&#60;/artifactId&#62; &#60;version&#62;4.8.2&#60;/version&#62; &#60;scope&#62;test&#60;/scope&#62; &#60;/dependency&#62; 有了正确的坐标,Maven才能够在正确的位置找到依赖文件并使用，这里值为test的scope是用来控制该依赖只在测试时可用，与坐标无关。 正因为坐标是Maven核心的核心，因此规划正确的坐标至关重要，如果你使用了模糊不清的坐标，那么你的用户就很难找到你的构件，或者即使找到了， 也容易写错。错误的使用坐标，还会造成冲突，如果你也使用junit这样的groupId，那会发生什么？下面先看一些不是很规范的坐标使用方式。 坐标规划的原则 滥用坐标、错用坐标的样例比比皆是，在中央仓库中我们能看到SpringFramework有两种坐标，其一是直接使用 springframework作为groupId，如springframework:spring-beans:1.2.6，另一种是用 org.springframework作为groupId，如org.springframework:spring-beans:2.5。细心看看， 前一种方式显得比较随意，后一种方式则是基于域名衍生出来的，显然后者更合理，因为用户能一眼根据域名联想到其Maven坐标，方便寻找。因此新版本的 SpringFramework构件都使用org.springframework作为groupId。由这个例子我们可以看到坐标规划一个原则是基于项目域名衍生。其实很多流行的开源项目都破坏了这个原则，例如JUnit，这是因为Maven社区在最开始接受构件并部署到中央仓库的时候，没有很很严格的限制，而对于这些流行的项目来说，一时间更改坐标会影响大量用户，因此也算是个历史遗留问题了。 还有一个常见的问题是将groupId直接匹配到公司或者组织名称，因为乍一看这是显而易见的。例如组织是zoo.com，有个项目是dog，那有 些人就直接使用groupId com.zoo了。如果项目只有一个模块，这是没有什么问题的，但现实世界的项目往往会有很多模块，Maven的一大长处就是通过多模块的方式管理项目。 那dog项目可能会有很多模块，我们用坐标的哪个部分来定义模块呢？groupId显然不对，version也不可能是，那只有artifactId。因 此要这里有了另外一个原则，用artifactId来定义模块，而不是定义项目。接下来，很显然的，项目就必须用groupId来定义。因此对于dog项目来说，应该使用groupId com.zoo.dog，不仅体现出这是zoo.com下的一个项目，而且可以与该组织下的其他项目如com.zoo.cat区分开来。 除此之外，artifactId的定义也有最佳实践，我们常常可以看到一个项目有很多的模块，例如api，dao，service，web等等。 Maven项目在默认情况下生成的构件，其名称不会是基于artifactId，version和packaging生成的，例如api-1.0.jar，dao-1.0.jar等 等，他们不会带有groupId的信息，这会造成一个问题，例如当我们把所有这些构件放到Web容器下的时候，你会发现项目dog有api- 1.0.jar，项目cat也有api-1.0.jar，这就造成了冲突。更坏的情况是，dog项目有api-1.0.jar，cat项目有api- 2.0.jar，其实两者没什么关系，可当放在一起的时候，却很容易让人混淆。为了让坐标更加清晰，又出现了一个原则，即在定义artiafctId时也加入项目的信息， 例如dog项目的api模块，那就使用artifactId dog-api，其他就是dog-dao，dao-service等等。虽然连字号是不允许出现在Java的包名中的，但Maven没这个限制。现在 dog-api-1.0.jar，cat-2.0.jar被放在一起时，就不容易混淆了。 关于坐标，我们还没谈到version，这里不再详述因为读者可以从Maven: The Complete Guide中找到详细的解释，简言之就是使用这样一个格式： &#60;主版本&#62;.&#60;次版本&#62;.&#60;增量版本&#62;-&#60;限定符&#62; 其中主版本主要表示大型架构变更，次版本主要表示特性的增加，增量版本主要服务于bug修复，而限定符如alpha、beta等等是用来表示里程 碑。当然不是每个项目的版本都要用到这些4个部分，根据需要选择性的使用即可。在此基础上Maven还引入了SNAPSHOT的概念，用来表示活动的开发 &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1497">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h2>坐标是什么？为什么要规划？</h2>
<p>坐标是<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>最基本的概念，它就像每个构件的身份证号码，有了它我们就可以在数以千万计的构件中定位任何一个我们感兴趣的构件。举个最简单的例子，如果没有坐标，使用JUnit的时候，用户就需要去<a href="http://junit.org/" target="_blank">下载</a>依赖jar包，用依赖的方式，简单配置使用如junit:junit:4.8.2就可以了。这里第一个junit是groupId，第二个junit是artifactId，4.8.2是version。</p>
<p><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>的很多其他核心机制都依赖于坐标，其中最显著的就是仓库和依赖管理。对于仓库来说，有了坐标就知道在什么位置存储构件的内容，例如junit:junit:4.8.2就对应仓库中的路径<code>/junit/junit/4.8.2/junit-4.8.2.pom</code>和<code>/junit/junit/4.8.2/junit-4.8.2.jar</code>这样的文件，读者可以直接访问<a href="http://repo1.maven.org/maven2/junit/junit/4.8.2/" target="_blank">中央仓库地址</a>看到这样的仓库布局，或者浏览本地仓库目录<code>~/.m2/repository/</code>以获得直观的体验。</p>
<p><span id="more-1497"></span></p>
<p>依赖的配置也是完全基于坐标的，例如：</p>
<pre>&lt;dependency&gt;
  &lt;groupId&gt;junit&lt;/groupId&gt;
  &lt;artifactId&gt;junit&lt;/artifactId&gt;
  &lt;version&gt;4.8.2&lt;/version&gt;
  &lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;</pre>
<p>有了正确的坐标,Maven才能够在正确的位置找到依赖文件并使用，这里值为test的scope是用来控制该依赖只在测试时可用，与坐标无关。</p>
<p>正因为坐标是Maven核心的核心，因此规划正确的坐标至关重要，如果你使用了模糊不清的坐标，那么你的用户就很难找到你的构件，或者即使找到了， 也容易写错。错误的使用坐标，还会造成冲突，如果你也使用junit这样的groupId，那会发生什么？下面先看一些不是很规范的坐标使用方式。</p>
<h2>坐标规划的原则</h2>
<p>滥用坐标、错用坐标的样例比比皆是，在中央仓库中我们能看到SpringFramework有两种坐标，其一是直接使用 springframework作为groupId，如springframework:spring-beans:1.2.6，另一种是用 org.springframework作为groupId，如org.springframework:spring-beans:2.5。细心看看， 前一种方式显得比较随意，后一种方式则是基于域名衍生出来的，显然后者更合理，因为用户能一眼根据域名联想到其Maven坐标，方便寻找。因此新版本的 SpringFramework构件都使用org.springframework作为groupId。由这个例子我们可以看到坐标规划一个原则是<em>基于项目域名衍生</em>。其实很多流行的开源项目都破坏了这个原则，例如JUnit，这是因为Maven社区在最开始接受构件并部署到中央仓库的时候，没有很很严格的限制，而对于这些流行的项目来说，一时间更改坐标会影响大量用户，因此也算是个历史遗留问题了。</p>
<p>还有一个常见的问题是将groupId直接匹配到公司或者组织名称，因为乍一看这是显而易见的。例如组织是zoo.com，有个项目是dog，那有 些人就直接使用groupId com.zoo了。如果项目只有一个模块，这是没有什么问题的，但现实世界的项目往往会有很多模块，Maven的一大长处就是通过多模块的方式管理项目。 那dog项目可能会有很多模块，我们用坐标的哪个部分来定义模块呢？groupId显然不对，version也不可能是，那只有artifactId。因 此要这里有了另外一个原则，<em>用artifactId来定义模块</em>，而不是定义项目。接下来，很显然的，<em>项目就必须用groupId来定义</em>。因此对于dog项目来说，应该使用groupId com.zoo.dog，不仅体现出这是zoo.com下的一个项目，而且可以与该组织下的其他项目如com.zoo.cat区分开来。</p>
<p>除此之外，artifactId的定义也有最佳实践，我们常常可以看到一个项目有很多的模块，例如api，dao，service，web等等。 Maven项目在默认情况下生成的构件，其名称不会是基于artifactId，version和packaging生成的，例如<code>api-1.0.jar</code>，<code>dao-1.0.jar</code>等 等，他们不会带有groupId的信息，这会造成一个问题，例如当我们把所有这些构件放到Web容器下的时候，你会发现项目dog有api- 1.0.jar，项目cat也有api-1.0.jar，这就造成了冲突。更坏的情况是，dog项目有api-1.0.jar，cat项目有api- 2.0.jar，其实两者没什么关系，可当放在一起的时候，却很容易让人混淆。为了让坐标更加清晰，又出现了一个原则，即在<em>定义artiafctId时也加入项目的信息</em>， 例如dog项目的api模块，那就使用artifactId dog-api，其他就是dog-dao，dao-service等等。虽然连字号是不允许出现在Java的包名中的，但Maven没这个限制。现在 dog-api-1.0.jar，cat-2.0.jar被放在一起时，就不容易混淆了。</p>
<p>关于坐标，我们还没谈到version，这里不再详述因为读者可以从<a href="http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-syntax.html#pom-relationships-sect-version-build-numbers" target="_blank">Maven: The Complete Guide</a>中找到详细的解释，简言之就是使用这样一个格式：</p>
<pre>&lt;主版本&gt;.&lt;次版本&gt;.&lt;增量版本&gt;-&lt;限定符&gt;</pre>
<p>其中主版本主要表示大型架构变更，次版本主要表示特性的增加，增量版本主要服务于bug修复，而限定符如alpha、beta等等是用来表示里程 碑。当然不是每个项目的版本都要用到这些4个部分，根据需要选择性的使用即可。在此基础上Maven还引入了SNAPSHOT的概念，用来表示活动的开发 状态，由于不涉及坐标规划，这里不进行详述。不过有点要提醒的是，由于SNAPSHOT的存在，自己显式地在version中使用时间戳字符串其实没有必 要。</p>
<h2><a name="d0e80"></a>Classifier</h2>
<p>Classifier可能是最容易被忽略的Maven特性，但它确实非常重要，我们也需要它来帮助规划坐标。设想这样一个情况，有一个jar项目，就说是<code> <code>dog-cli-1.0.jar</code> </code>吧，运行它用户就能在命令行上画一只小狗出来。现在用户的要求是希望你能提供一个zip包，里面不仅包含这个可运行的jar，还得包含源代码和文档，换句话说，这是比较正式的分发包。这个文件名应该是怎样的呢？<code>dog-cli-1.0.zip</code>？不够清楚，仅仅从扩展名很难分辨什么是Maven默认生成的构件，什么是额外配置生成分发包。如果能是<code>dog-cli-1.0-dist.zip</code>就最好了。这里的dist就是classifier，默认Maven只生成一个构件，我们称之为主构件，那<em>当我们希望Maven生成其他附属构件的时候，就能用上classifier</em>。常见的classifier还有如<code>dog-cli-1.0-sources.jar</code>表示源码包，<code>dog-cli-1.0-javadoc.jar</code>表示JavaDoc包等等。制作classifier的方式多种多样，其中最重要的一种是使用<a href="http://maven.apache.org/plugins/maven-assembly-plugin/" target="_blank">Maven Assembly Plugin</a>，感兴趣的读者可以进一步研究。</p>
<h2><a name="d0e109"></a>小结</h2>
<p>本文是InfoQ Maven专栏的第一篇，讨论的是Maven坐标的规划，包括如何正确的使用groupId、artifactId、version，以及 classfier。笔者在维护Maven中央仓库的工作过程中遇到过各种各样模糊的甚至是错误的坐标，它们的存在给广大Maven用户带来的极大的不 便。本文抛出一些较好的实践，帮助大家更好的使用Maven。如果读者有相关的经验总结，也请不吝分享。</p>
<p><em>本文已经首发于<a href="http://www.infoq.com/cn" target="_blank">InfoQ中文站</a>，版权所有，原文为<a href="http://www.infoq.com/cn/news/2010/12/xxb-maven-1" target="_blank">《Maven实战（一）——坐标规划》</a>，如需转载，请务必附带本声明，谢谢。</em>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1497">转：Maven实战（一）——坐标规划</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1497&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1497/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>推荐：国内第一本Maven书籍——《Maven实战》</title>
		<link>http://www.wsria.com/archives/1480</link>
		<comments>http://www.wsria.com/archives/1480#comments</comments>
		<pubDate>Fri, 19 Nov 2010 01:57:46 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[业界动态]]></category>
		<category><![CDATA[书籍]]></category>
		<category><![CDATA[Juven]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven实战]]></category>
		<category><![CDATA[SpringSide]]></category>
		<category><![CDATA[推荐]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1480</guid>
		<description><![CDATA[引言 我是由于学习SpringSide的缘故接触到了Maven工具，因为Maven的缘故接触到了业内公认的Maven专家Juven，从而以后一直关注Maven的发展当然包括今天要推荐的这本国内第一本Maven书籍《Maven实战》。 几个月前我开始学习Maven，加入到了Juven建立的Maven中文群，当时参考了Juven翻译的《Maven权威指南》，很遗憾权威指南没有出版，所以Juven自己撰写了符合国人阅读习惯的《Maven实战》，相信最早接触Maven的人都是参考的权威指南，我敢说从现在开始接触Maven的新人看的书应该是《Maven实战》。 我大致浏览过这本书的目录还算是比较全面的，在日常开发中我们需要用到的工具、需要知道的知识点、技巧基本都可以满足；不入虎穴焉得虎子， Juven目前就职于Sonatype，是Nexus团队的成员 并维护 https://oss.sonatype.org/ 和Maven中央库 正式因为他深入了解Maven的各个方面所以我们有理由说这是一本好书，看过了权威指南让我很快学会了使用Maven解决一些以往反复、复杂的事情，让我的项目管理更加规范，所以新人选择这本书是可以事半功倍的办法。 引用Juven博客 你是否早已厌倦了日复一日的手工构建工作？你是否对各个项目风格迥异的构建系统感到恐惧？Maven——这一Java社区事实标准的项目管理工具，能帮你从琐碎的手工劳动中解脱出来，帮你规范整个组织的构建系统。不仅如此，它还有依赖管理、自动生成项目站点等超酷的特性。已经有无数的开源项目使用它来构建项目，促进团队交流。每天都由数以万计的开发者在访问中央仓库以获取他们需要的依赖。 由国内的Maven权威亲自执笔，《Maven实战》告诉你Maven的本质是什么，深入阐述Maven的依赖管理、仓库、生命周期、插件等核心概念。你还能看到实际的案例演变，以及诸如多模块组织、建立Nexus私服、使用Hudson进行持续集成等企业开发的最佳实践。 深入了解《Maven实战》 请访问作者Juven的博客：http://www.juvenxu.com/mvn-in-action/ 正入我一直我的座右铭一样：“工欲善其事必先利其器”，Maven帮我做到了，希望这本书能带你进入Maven世界，一个事半功倍的好工具，一本好书。 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: 推荐：国内第一本Maven书籍——《Maven实战》]]></description>
			<content:encoded><![CDATA[<h3>引言</h3>
<p>我是由于学习<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/springside" title="查看 SpringSide 中所有文章" target="_blank">SpringSide</a></span>的缘故接触到了<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>工具，因为<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>的缘故接触到了业内公认的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>专家<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/juven" title="查看 Juven 中所有文章" target="_blank">Juven</a></span>，从而以后一直关注Maven的发展当然包括今天要<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e6%8e%a8%e8%8d%90" title="查看 推荐 中所有文章" target="_blank">推荐</a></span>的这本国内第一本Maven书籍《<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven%e5%ae%9e%e6%88%98" title="查看 Maven实战 中所有文章" target="_blank">Maven实战</a></span>》。<br />
几个月前我开始学习Maven，加入到了<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/juven" title="查看 Juven 中所有文章" target="_blank">Juven</a></span>建立的Maven中文群，当时参考了Juven翻译的《Maven权威指南》，很遗憾权威指南没有出版，所以Juven自己撰写了符合国人阅读习惯的《<a href="http://www.juvenxu.com/mvn-in-action/" target="_blank">Maven实战</a>》，相信最早接触Maven的人都是参考的权威指南，我敢说从现在开始接触Maven的新人看的书应该是《<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven%e5%ae%9e%e6%88%98" title="查看 Maven实战 中所有文章" target="_blank">Maven实战</a></span>》。<br />
我大致浏览过这本书的目录还算是比较全面的，在日常开发中我们需要用到的工具、需要知道的知识点、技巧基本都可以满足；不入虎穴焉得虎子，</p>
<blockquote><p>Juven目前就职于Sonatype，是Nexus团队的成员<br />
并维护 https://oss.sonatype.org/ 和Maven中央库
</p></blockquote>
<p>正式因为他深入了解Maven的各个方面所以我们有理由说这是一本好书，看过了权威指南让我很快学会了使用Maven解决一些以往反复、复杂的事情，让我的项目管理更加规范，所以新人选择这本书是可以事半功倍的办法。</p>
<h3>引用Juven博客</h3>
<blockquote><p>你是否早已厌倦了日复一日的手工构建工作？你是否对各个项目风格迥异的构建系统感到恐惧？Maven——这一Java社区事实标准的项目管理工具，能帮你从琐碎的手工劳动中解脱出来，帮你规范整个组织的构建系统。不仅如此，它还有依赖管理、自动生成项目站点等超酷的特性。已经有无数的开源项目使用它来构建项目，促进团队交流。每天都由数以万计的开发者在访问中央仓库以获取他们需要的依赖。</p>
<p>由国内的Maven权威亲自执笔，《Maven实战》告诉你Maven的本质是什么，深入阐述Maven的依赖管理、仓库、生命周期、插件等核心概念。你还能看到实际的案例演变，以及诸如多模块组织、建立Nexus私服、使用Hudson进行持续集成等企业开发的最佳实践。<br />
<div id="attachment_1481" class="wp-caption aligncenter" style="width: 239px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/maven-in-action.jpg" rel="lightbox[1480]" title="maven-in-action"><img src="http://www.wsria.com/wp-content/uploads/2010/11/maven-in-action-229x300.jpg" alt="Maven实战封面" title="maven-in-action" width="229" height="300" class="size-medium wp-image-1481" /></a><p class="wp-caption-text">Maven实战封面</p></div>
</p></blockquote>
<h3>深入了解《Maven实战》</h3>
<p>请访问作者Juven的博客：<a href="http://www.juvenxu.com/mvn-in-action/">http://www.juvenxu.com/mvn-in-action/</a></p>
<p>正入我一直我的座右铭一样：“工欲善其事必先利其器”，Maven帮我做到了，希望这本书能带你进入Maven世界，一个事半功倍的好工具，一本好书。
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1480">推荐：国内第一本Maven书籍——《Maven实战》</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1480&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1480/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Maven多模块布局实例详解</title>
		<link>http://www.wsria.com/archives/1405</link>
		<comments>http://www.wsria.com/archives/1405#comments</comments>
		<pubDate>Thu, 11 Nov 2010 06:14:47 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[后台技术]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[dbunit]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[多模块]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1405</guid>
		<description><![CDATA[全面介绍maven多模块布局<p class="read-more"><a href="http://www.wsria.com/archives/1405">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h3>一、开场白</h3>
<p>使用<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>有段时间了，只能感慨真是个好东西，让我从传统模式体会到了严谨、规范、敏捷、方便的特性。<br />
如果你懂<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>或许看过Juven翻译的《<a href="http://www.juvenxu.com/mvn-def-guide/" target="_blank">Maven权威指南</a>》；<br />
发个牢骚：由于Maven的出身问题导致学习曲线陡峭，所有有些人就开始说Maven不好用；原因有二：一是排斥Maven，二是没有耐心和精下心来学习，引用老毛的话来提醒我说的那些人：</p>
<blockquote><p>没有调查就没有发言权</p></blockquote>
<p>到了Maven这里就是(适用于技术方面)：</p>
<blockquote><p>没有深入学习也没有发言权</p></blockquote>
<p>如果Maven不好那么<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/spring" title="查看 Spring 中所有文章" target="_blank">Spring</a></span>、Hibernate这些大家经常使用的框架为什么还是从ant转移到Maven？<br />
如果Maven不好那么为什么国外大多数项目都在使用Maven呢？<br />
原因自己考虑，我不废话！我的这些话就是告诫那些<strong>信口雌黄</strong>的人。</p>
<h3>二、<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e5%a4%9a%e6%a8%a1%e5%9d%97" title="查看 多模块 中所有文章" target="_blank">多模块</a></span>布局概述</h3>
<p>详细属性Maven的童鞋们都看过《Maven权威指南》，里面也讲解如何搭建<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e5%a4%9a%e6%a8%a1%e5%9d%97" title="查看 多模块 中所有文章" target="_blank">多模块</a></span>的Maven项目，但是那个毕竟是比较简单的，在实际应用中就有点水土不服了；<br />
后来又参考了Juven的一篇《<a href="http://juvenshun.javaeye.com/blog/305865" target="_blank">Maven最佳实践：划分模块</a>》博文，相对权威指南来说介绍的比较详细了，但是这还是不能满足我真正在企业应用的需求，等你看完Juven的博文后再看看下面这个实际应用中的项目布局有什么异同：</p>
<div id="attachment_1409" class="wp-caption aligncenter" style="width: 481px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-constructor2.jpg" rel="lightbox[1405]" title="maven-multi-module-constructor2"><img class="size-full wp-image-1409" title="maven-multi-module-constructor2" src="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-constructor2.jpg" alt="Maven多模块布局概图" width="471" height="420" /></a><p class="wp-caption-text">Maven多模块布局概图</p></div>
<p>OK，现在应该看出来有什么不同了，我的项目结构比权威指南里面的介绍复杂、比Juven的那篇文章说的也复杂，接下来再看看这张图片：</p>
<div id="attachment_1411" class="wp-caption aligncenter" style="width: 329px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/juven-maven-multi-construction.png" rel="lightbox[1405]" title="juven-maven-multi-construction"><img class="size-full wp-image-1411" title="juven-maven-multi-construction" src="http://www.wsria.com/wp-content/uploads/2010/11/juven-maven-multi-construction.png" alt="plexus-security项目结构" width="319" height="338" /></a><p class="wp-caption-text">plexus-security项目结构</p></div><br />
<span id="more-1405"></span><br />
上面这张图片是我在写这篇文章的时候刚刚找到的：《<a href="http://juvenshun.javaeye.com/blog/565240" target="_blank">按需构建多模块，玩转Maven反应堆</a>》，和上面的<strong>Maven多模块布局概图</strong>对比一下是不是基本一样？真是后悔当初怎么没有看到Juven的这篇文章，后来把<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/hibernate" title="查看 hibernate 中所有文章" target="_blank">hibernate</a></span>的项目checkout下来分析他的maven多模块结构布局然后再结合实际应用得出的<strong>Maven多模块布局概图</strong>。<br />
OK，现在你对多模块布局有了初步的印象了，接下来才是重点，逐个击破、逐个分析。</p>
<h3>三、多模块布局详解</h3>
<p>无图无真相，有图才给力：(如果想真正了解多模块那么请先看着图片和说明揣摩一下含义……)</p>
<p><div id="attachment_1417" class="wp-caption aligncenter" style="width: 603px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-construction.jpg" rel="lightbox[1405]" title="maven-multi-module-construction"><img class="size-full wp-image-1417" title="maven-multi-module-construction" src="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-construction.jpg" alt="Maven多模块布局概述图" width="593" height="281" /></a><p class="wp-caption-text">Maven多模块布局概述图</p></div>
<p><strong>声明</strong>：由于是本例是根据实际应用的项目来分析的，所以会比之前说的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e6%95%99%e7%a8%8b" title="查看 教程 中所有文章" target="_blank">教程</a></span>和Juven的文章实例复杂一些。</p>
<ol>
<li><strong>denong-pb</strong>：先看实例pom.<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/xml" title="查看 xml 中所有文章" target="_blank">xml</a></span>：

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.0.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.wsria<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dn-pb<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0.5-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Denong Point Bank<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;packaging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pom<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/packaging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- 设定团队持续集成发布包服务器  --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;distributionManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>nexus<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Team Nexus Release Repository<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://192.168.1.111:8081/nexus/content/repositories/releases<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;snapshotRepository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>nexus<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Team Nexus Snapshot Repository<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://192.168.1.111:8081/nexus/content/repositories/snapshots<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uniqueVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/uniqueVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/snapshotRepository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/distributionManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;connection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>scm:svn:https://192.168.1.111:8443/svn/denong/pb/trunk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/connection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>https://192.168.1.111:8443/svn/denong/pb/trunk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>common<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>entity<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>data<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dao<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>service<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>web-parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>web-admin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>web-site<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;defaultGoal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>install<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/defaultGoal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-release-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0-beta-9<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;autoVersionSubmodules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/autoVersionSubmodules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</li>
<li><strong>bin</strong>：<em>可有可无</em>，存放一些maven的命令批处理文件或者快捷bat文件，比如本地install项目或者打包根据产品profile（在模块中配置id为product的profile）打包war；</li>
<li><strong>common</strong>：估计有一些经验的人都会把一些常用的工具类封装起来，由经验丰富的人来维护到common模块中作为技术沉淀和公司的公共类库，方便大家快速开发使用。当然实际应用中可能会使用公司已经存在的common模块，然后单个项目中可能会再加入一个common模块，一般公司的common包都是这么积累下来的；</li>
<li><strong>dao</strong>：每个模块的数据存取类，因为本项目是根据springside基础上构建的，所以都是继承HibernateDao，如果涉及到大数据量或者存储过程的调用会再加入相应的*JdbcDao；</li>
<li><strong>data</strong>：
<div id="attachment_1435" class="wp-caption aligncenter" style="width: 286px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-data.jpg" rel="lightbox[1405]" title="maven-multi-module-data"><img class="size-full wp-image-1435" title="maven-multi-module-data" src="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-data.jpg" alt="data模块结构" width="276" height="286" /></a><p class="wp-caption-text">data模块结构</p></div>
<p>，根据上图介绍一下：除了data目录外其他的配置文件都是在测试期间使用的，根据不同需求使用不同配置文件，例如一些不需要spring启动时初始化的数据使用applicationContext-test-no-init-sql.<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/xml" title="查看 xml 中所有文章" target="_blank">xml</a></span>，这个没有什么规定，根据项目来设置；<strong>data</strong>目录是存放一些使用<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/dbunit" title="查看 dbunit 中所有文章" target="_blank">dbunit</a></span>导出的xml数据文件，作用是在单元测试时的数据初始化或者利用数据文件初始化指定的数据库，一般这些数据文件的类型包括：数据字典、系统配置参数等</li>
<li><strong>entity</strong>：这里说一下JPA注解的实体工具，开始我使用的是eclipse3.6的JPA工具，但是发现有些属性加不上@Column注解很是郁闷，只能手动加入；当然你也可以使用springside中提供的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/hibernate" title="查看 hibernate 中所有文章" target="_blank">hibernate</a></span>tools模板生成，但是我还是希望在生成期间能完全受控，所以最好想到了My<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/eclipse" title="查看 Eclipse 中所有文章" target="_blank">Eclipse</a></span>，配置好数据源然后从数据库中逆向生成JPA，所有字段都正确配置；</li>
<li><strong><em>parent</em></strong>：这里<strong>着重介绍</strong>一下，此模块是所有子模块需要继承的超级POM，举个例子容易理解：把本项目(denong-pb)当做是Java语言，那么parent模块就是Object类，此模块只负责定影其他子模块需要使用的一些公共设置，谨记：<br />
<blockquote><p>parent不负责管理子模块，只是被子模块集成，千万不要和denong-pb目录的pom.xml混淆</p></blockquote>
</li>
<li><strong>service</strong>：就是业务处理类，供web模块调用；</li>
<li><strong>web-parent</strong>：供web*模块继承，例如前后台都需要调用的Action接口，像数据字典、地区信息、系统属性等</li>
<li><strong>web-admin</strong>：系统的后台管理程序，使用了struts2的convention插件；</li>
<li><strong>web-site</strong>：系统网站部分，同样使用了struts2的convention插件，集成<a href="http://www.wsria.com/archives/1349" target="_blank">单点登录</a>功能</li>
</ol>
<h3>四、模块之间依赖关系</h3>
<p>直观<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e6%95%99%e7%a8%8b" title="查看 教程 中所有文章" target="_blank">教程</a></span>图片最给力：<br />
<div id="attachment_1444" class="wp-caption aligncenter" style="width: 420px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-relation.png" rel="lightbox[1405]" title="maven-multi-module-relation"><img src="http://www.wsria.com/wp-content/uploads/2010/11/maven-multi-module-relation.png" alt="Maven多模块关系依赖图" title="maven-multi-module-relation" width="410" height="324" class="size-full wp-image-1444" /></a><p class="wp-caption-text">Maven多模块关系依赖图</p></div></p>
<h3>五、和SVN的整合——maven-release-plugin</h3>
<p><a href="http://maven.apache.org/plugins/maven-release-plugin/" target="_blank">maven-release-plugin</a>是经常使用的插件，这里简单介绍一下，要点：</p>
<ol>
<li><strong>每个模块的scm配置</strong>：

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;connection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>scm:svn:https://192.168.1.111:8443/svn/denong/pb/trunk/模块名称<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/connection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>https://192.168.1.111:8443/svn/denong/pb/trunk/模块名称<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<blockquote><p>上面的scm配置在每一个模块中存在，因为每一个模块再svn目录中有单独的目录；</p></blockquote>
<p>但是parent模块有点不同，因为除了parent模块其他子模块需要继承parent，如下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.wsria<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0.5-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;relativePath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>../parent/pom.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/relativePath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dn-pb-entity<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>parent模块设定了一些被子模块集成的插件，maven-release-plugin当然也在列，除了GAV之外最重要的就是tagBase标签：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- release插件 --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-release-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0-beta-9<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tagBase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>https://192.168.1.111:8443/svn/denong/pb/tags/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tagBase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${svn.name}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${svn.pwd}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>本地的settings.xml中配置(替换${svn.name}和${svn.pwd}，也就是svn提交时的用户名和密码)：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;settings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>denong-product<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svn.name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>kafeitu<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/svn.name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svn.pwd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>123456<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/svn.pwd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/settings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>在denong-pb目录中执行命令：</p>
<blockquote><p>D:\wsria\projects\denong\denong-pb>mvn release:prepare -Pdenong-product</p></blockquote>
<p>在svn中自动打的tag结构为：<br />
<div id="attachment_1448" class="wp-caption aligncenter" style="width: 174px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/svn-tag-construction.jpg" rel="lightbox[1405]" title="svn-tag-construction"><img src="http://www.wsria.com/wp-content/uploads/2010/11/svn-tag-construction.jpg" alt="maven-release-plugin执行release:prepare后的svn结构" title="svn-tag-construction" width="164" height="294" class="size-full wp-image-1448" /></a><p class="wp-caption-text">maven-release-plugin执行release:prepare后的svn结构</p></div><br />
接下来就可以执行命令：</p>
<blockquote><p>D:\wsria\projects\denong\denong-pb>mvn release:perform</p></blockquote>
</li>
</ol>
<h3>六、多模块布局问题</h3>
<p>如果你够细心可能发现了上面出现了relativePath属性，这个再多模块的配置中经常遇到的问题，根据目前的案例来说子模块和parent是同级的目录，但是每个子模块又都需要继承parent模块的一些配置，比如上面介绍的到common模块会使用如下配置：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.wsria<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0.5-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>common<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>现在问题来了，在common模块下执行命令：mvn compile，得到的结果中包含了警告信息：</p>
<blockquote><p>[WARNING] &#8216;parent.relativePath&#8217; points at com.wsria:dn-pb instead of com.wsria:dn-pb-parent, please verify your project structure @ line 4, column 10</p></blockquote>
<p>意思是找不到dn-pb-parent这个模块……因为maven不知道dn-pb-parent模块存在的位置才会导致警告信息的出现，解决办法是手动指定dn-pb-parent模块的位置，所以最终的解决办法是在parent标签中加入：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;relativePath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>../parent/pom.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/relativePath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>这样maven就知道继承的parent的具体位置了，</p>
<blockquote><p>relativePath默认值为../pom.xml，参考：<a href="http://maven.apache.org/ref/3.0/maven-model/maven.html" target="_blank">http://maven.apache.org/ref/3.0/maven-model/maven.html</a></p></blockquote>
<p>完整的parent继承配置：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.wsria<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dn-pb-parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0.5-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;relativePath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>../parent/pom.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/relativePath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dn-pb-common<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>现在运行mvn命令一切正常了;</p>
<blockquote><p>记得每一个继承parent模块的子模块都需要添加relativePath设置</p></blockquote>
<h3>七、多模块开发期间<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/debug" title="查看 Debug 中所有文章" target="_blank">Debug</a></span></h3>
<p>一般我们在开发web模块的时候会启用tomcat或者jboss的debug模式来断点调试应用，但是你会发现如果web模块依赖了service模块想进入service模块debug但是eclipse却告诉你找不到class的源码，解决办法：</p>
<blockquote><p>把service模块加入到Build Path的Project列表中</p></blockquote>
<h3>八、其他方案</h3>
<p>如何布局是根据每一个项目组的安排定义的，比如</p>
<ol>
<li>一个项目组分模块开发的话或许不像本例一样分模块而是把每一层都集中在一个项目中</li>
<li>或许web模块单独一个子模块，其他的entyty、dao、service集中在一个子模块model中</li>
</ol>
<blockquote><p><strong>怎么布局需要根据项目实际情况来定义</strong>，当然要考虑到单个子模块的重复利用，例如service模块在本例中被web-admin和web-site模块使用，如果以后再加入webservice模块那么webservice也要依赖，或许还有命令行(command)模块也要依赖</p></blockquote>
<h3>九、结束语</h3>
<p>这是一篇难产的文章，有些原因影响经过了3个晚上才出世，呵呵<br />
有不对的地方请留言以改正；<br />
分享这篇文章的目的就是给刚刚接触或者正需要maven多模块布局的童鞋们参考，希望能对你有帮助，谢谢关注！
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1405">Maven多模块布局实例详解</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1405&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1405/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WordPress整合Google Buzz Button</title>
		<link>http://www.wsria.com/archives/1425</link>
		<comments>http://www.wsria.com/archives/1425#comments</comments>
		<pubDate>Sat, 06 Nov 2010 18:24:33 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[博客公告]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[buzz]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1425</guid>
		<description><![CDATA[为了方便大家分享文章：特地挑选了一个插件来支持此功能，挑选了大概10个类似的插件，最后决定使用：wp-google-buzz 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: WordPress整合Google Buzz Button]]></description>
			<content:encoded><![CDATA[<p>为了方便大家分享文章：特地挑选了一个插件来支持此功能，挑选了大概10个类似的插件，最后决定使用：<a href="http://wordpress.org/extend/plugins/wp-google-buzz/">wp-google-buzz</a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1425">WordPress整合Google Buzz Button</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1425&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1425/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CAS单点登录(SSO)完整教程(2012-02-01更新)</title>
		<link>http://www.wsria.com/archives/1349</link>
		<comments>http://www.wsria.com/archives/1349#comments</comments>
		<pubDate>Fri, 05 Nov 2010 12:25:51 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[个人作品]]></category>
		<category><![CDATA[后台技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[解决方案]]></category>
		<category><![CDATA[CAS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[SSO]]></category>
		<category><![CDATA[单点登录]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1349</guid>
		<description><![CDATA[一、教程前言 教程目的：从头到尾细细道来单点登录服务器及客户端应用的每个步骤 单点登录（SSO）：请看百科解释猛击这里打开 本教程使用的SSO服务器是Yelu大学研发的CAS(Central Authentication Server)，官网：http://www.jasig.org/cas 本教程环境： Tomcat6.0.29 JDK6 CAS Server版本：cas-server-3.4.3.1、cas-server-3.4.10 CAS Client版本：cas-client-3.1.12、cas-client-3.2.1 教程撰写日期：2010-11-05(第一版)、2011-11-05(一年后更新)、2012-02-01(异常处理) 教程作者：咖啡兔 二、创建证书 啰嗦几句：证书是单点登录认证系统中很重要的一把钥匙，客户端于服务器的交互安全靠的就是证书；本教程由于是演示所以就自己用JDK自带的keytool工具生成证书；如果以后真正在产品环境中使用肯定要去证书提供商去购买，证书认证一般都是由VeriSign认证，中文官方网站：http://www.verisign.com/cn/ 用JDK自带的keytool工具生成证书： 命令：keytool -genkey -alias wsria -keyalg RSA -keystore d:/keys/wsriakey 无图不给力，有图有真相： 具体的输入项图片中都有说明，有一点我要解释一下；在输入完密码后提示输入域名是我输入的是sso.wsria.com，其实这个域名是不存在的，但是我为了演示所以虚拟了这个域名，技巧在于修改C:\Windows\System32\drivers\etc\hosts，添加内容如下： 127.0.0.1 sso.wsria.com 这样在访问sso.wsria.com的时候其实是访问的127.0.0.1也就是本机 严重提醒：提示输入域名的时候不能输入IP地址 三、导出证书 命令：D:\keys>keytool -export -file d:/keys/wsria.crt -alias wsria -keystore &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1349">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h3>一、教程前言</h3>
<ol>
<li>教程目的：从头到尾细细道来<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95" title="查看 单点登录 中所有文章" target="_blank">单点登录</a></span>服务器及客户端应用的每个步骤</li>
<li><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95" title="查看 单点登录 中所有文章" target="_blank">单点登录</a></span>（<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/sso" title="查看 SSO 中所有文章" target="_blank">SSO</a></span>）：请看百科解释<a href="http://baike.baidu.com/view/993620.htm">猛击这里打开</a></li>
<li>本教程使用的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/sso" title="查看 SSO 中所有文章" target="_blank">SSO</a></span>服务器是Yelu大学研发的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/cas" title="查看 CAS 中所有文章" target="_blank">CAS</a></span>(Central Authentication Server)，<br/>官网：<a href="http://www.jasig.org/cas">http://www.jasig.org/cas</a></li>
<li>本教程环境：
<ul>
<li>Tomcat6.0.29</li>
<li>JDK6</li>
<li><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/cas" title="查看 CAS 中所有文章" target="_blank">CAS</a></span> Server版本：cas-server-3.4.3.1、cas-server-3.4.10</li>
<li>CAS Client版本：cas-client-3.1.12、cas-client-3.2.1</li>
<li>教程撰写日期：2010-11-05(第一版)、2011-11-05(一年后更新)、2012-02-01(异常处理)</li>
<li>教程作者：<a href="http://www.wsria.com">咖啡兔</a></li>
</ul>
</li>
</ol>
<h3>二、创建证书</h3>
<p>啰嗦几句：证书是<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95" title="查看 单点登录 中所有文章" target="_blank">单点登录</a></span>认证系统中很重要的一把钥匙，客户端于服务器的交互安全靠的就是证书；本教程由于是演示所以就自己用JDK自带的keytool工具生成证书；如果以后真正在产品环境中使用肯定要去证书提供商去购买，证书认证一般都是由VeriSign认证，<br/>中文官方网站：<a href="http://www.verisign.com/cn/" target="_blank">http://www.verisign.com/cn/</a><br />
<span id="more-1349"></span></p>
<ol>
<li>用JDK自带的keytool工具生成证书：<br />
<blockquote><p>命令：keytool -genkey -alias wsria -keyalg RSA -keystore d:/keys/wsriakey</p></blockquote>
</li>
</ol>
<p>无图不给力，有图有真相：<div id="attachment_1358" class="wp-caption alignleft" style="width: 632px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/use-keytool-create-key.gif" rel="lightbox[1349]" title="use-keytool-create-key"><img src="http://www.wsria.com/wp-content/uploads/2010/11/use-keytool-create-key.gif" alt="用keytool生成证书" title="use-keytool-create-key" width="622" height="342" class="size-full wp-image-1358" /></a><p class="wp-caption-text">用keytool生成证书</p></div><br />
具体的输入项图片中都有说明，有一点我要解释一下；在输入完密码后提示输入域名是我输入的是sso.wsria.com，其实这个域名是不存在的，但是我为了演示所以虚拟了这个域名，技巧在于修改C:\Windows\System32\drivers\etc\hosts，添加内容如下：</p>
<blockquote><p>127.0.0.1	sso.wsria.com</p></blockquote>
<p>这样在访问sso.wsria.com的时候其实是访问的127.0.0.1也就是本机</p>
<blockquote><p><strong>严重提醒</strong>：提示输入域名的时候<strong>不能</strong>输入<strong>IP地址</strong></p></blockquote>
<h3>三、导出证书</h3>
<blockquote><p>命令：D:\keys>keytool -export -file d:/keys/wsria.crt -alias wsria -keystore d:/keys/wsriakey</p></blockquote>
<blockquote><p><strong>特别提示：</strong>如果提示
<p>keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect</p>
<p>那么请输入密码：<strong>changeit</strong></p></blockquote>
<p>来点颜色：<div id="attachment_1367" class="wp-caption alignleft" style="width: 610px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/use-keytool-export-crt.gif" rel="lightbox[1349]" title="use-keytool-export-crt"><img src="http://www.wsria.com/wp-content/uploads/2010/11/use-keytool-export-crt.gif" alt="使用keytool导出证书" title="use-keytool-export-crt" width="600" class="size-medium wp-image-1367" /></a><p class="wp-caption-text">使用keytool导出证书</p></div><br />
至此导出证书完成，可以分发给应用的JDK使用了，接下来讲解客户端的JVM怎么导入证书</p>
<h3>四、为客户端的JVM导入证书</h3>
<blockquote><p>命令：keytool -import -keystore D:\tools\jdk\1.6\jdk1.6.0_20\jre\lib\security\cacerts -file D:/keys/wsria.crt -alias wsria</p></blockquote>
<p>来点颜色瞧瞧：<div id="attachment_1371" class="wp-caption alignleft" style="width: 610px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/use-keytool-import-crt-to-client-jvm.gif" rel="lightbox[1349]" title="use-keytool-import-crt-to-client-jvm"><img src="http://www.wsria.com/wp-content/uploads/2010/11/use-keytool-import-crt-to-client-jvm.gif" alt="为客户端JVM导入证书" title="use-keytool-import-crt-to-client-jvm" width="600" height="242" class="size-full wp-image-1371" /></a><p class="wp-caption-text">为客户端JVM导入证书</p></div><br />
<font color='red'><strong>特别说明</strong></font>：D:\tools\jdk\1.6\jdk1.6.0_20\jre\lib\security &#8212; 是jre的目录；密码还是刚刚输入的密码。<br />
至此证书的创建、导出、导入到客户端JVM都已完成，下面开始使用证书到Web服务器中，本教程使用tomcat。</p>
<h3>五、应用证书到Web服务器-Tomcat</h3>
<p>说是应用起始做的事情就是启用Web服务器(Tomcat)的SSL，也就是HTTPS加密协议，为什么加密我就不用啰嗦了吧……<br />
准备好一个干净的tomcat，本教程使用的apache-tomcat-6.0.29<br />
打开tomcat目录的conf/server.xml文件，开启83和87行的注释代码，并设置keystoreFile、keystorePass修改结果如下：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Connector</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;8443&quot;</span> <span style="color: #000066;">protocol</span>=<span style="color: #ff0000;">&quot;HTTP/1.1&quot;</span> <span style="color: #000066;">SSLEnabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">maxThreads</span>=<span style="color: #ff0000;">&quot;150&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;https&quot;</span> <span style="color: #000066;">secure</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">clientAuth</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">sslProtocol</span>=<span style="color: #ff0000;">&quot;TLS&quot;</span> </span>
<span style="color: #009900;">	       <span style="color: #000066;">keystoreFile</span>=<span style="color: #ff0000;">&quot;D:/keys/wsriakey&quot;</span></span>
<span style="color: #009900;">	       <span style="color: #000066;">keystorePass</span>=<span style="color: #ff0000;">&quot;wsria.com&quot;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>参数说明：</p>
<ul>
<li>keystoreFile：在第一步创建的key存放位置</li>
<li>keystorePass：创建证书时的密码</li>
</ul>
<p>好了，到此Tomcat的SSL启用完成，现在你可以启动tomcat试一下了，例如本教程输入地址：https://sso.wsria.com:8443/<br />
打开的是：<div id="attachment_1374" class="wp-caption aligncenter" style="width: 509px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/explorer-tip-unsafe-crt-1.gif" rel="lightbox[1349]" title="explorer-tip-unsafe-crt-1"><img src="http://www.wsria.com/wp-content/uploads/2010/11/explorer-tip-unsafe-crt-1.gif" alt="浏览器提示证书错误" title="explorer-tip-unsafe-crt-1" width="499" height="452" class="size-full wp-image-1374" /></a><p class="wp-caption-text">浏览器提示证书错误</p></div><br />
好的，那么我们点击“继续浏览此网站(不推荐)。 ”，现在进入Tomcat目录了吧，如果是那么你又向成功迈进了一步。<br />
OK，接下来要配置CAS服务器了。</p>
<h3>六、CAS服务器初体验</h3>
<ol>
<li>CAS服务端下载：<a href="http://www.jasig.org/cas/download" target="_blank">http://www.jasig.org/cas/download</a></li>
<li>下载完成后将cas-server-3.4.3.1.zip解压，解压cas-server-3.4.3/modules/cas-server-webapp-3.4.3.1.war，改名为cas，然后复制cas目录到你的tomcat/webapp目录下</li>
<li>现在可以访问CAS应用了，当然要使用HTTPS加密协议访问，<br/>例如本教程地址：https://sso.wsria.com:8443/cas/login ，现在打开了CAS服务器的页面输入admin/admin点击登录（CAS默认的验证规则只要用户名和密码相同就通过）所以如果你看到下面的这张图片你就成功了</li>
</ol>
<p><div id="attachment_1378" class="wp-caption alignleft" style="width: 621px"><a href="http://www.wsria.com/wp-content/uploads/2010/11/cas-login-success.gif" rel="lightbox[1349]" title="cas-login-success"><img src="http://www.wsria.com/wp-content/uploads/2010/11/cas-login-success.gif" alt="CAS登录成功" title="cas-login-success" width="611" height="265" class="size-full wp-image-1378" /></a><p class="wp-caption-text">CAS登录成功</p></div><br />
你成功了吗？如果没有成功请再检查以上步骤！</p>
<blockquote><p><strong>2011-11-05更新说明</strong>：<span style='display:none'>对于3.4.10版本来官方没有直接提供war包而仅仅提供了源码，因为官方使用maven构建项目，所以需要读者自己构建打包，其实也比较简单，请参考文章最后面的构建说明。</span></p>
<h4>使用<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>构建：</h4>
<p>使用cmd或者shell进入cas-server-3.4.10目录，运行：mvn package -pl cas-server-webapp,cas-server-support-jdbc</p>
<p>意思是只需要构建cas-server-webapp和cas-server-support-jdbc，如果需要其他的请根据文件夹名称设置或者构建全部模块，打包全部模块命令：mvn package 即可。打包过程中会从网络下载需要的jar包，请耐心等待；如果在~/.m2/settings.xml中定义了mirror代理<mirrorOf>*</mirrorOf>，那么请把*随便修改一个字符，否则下载jar包会失败！
</p>
<p>打包完成后就可以从cas-server-webapp/target/cas.war复制到你的tomcat/webapp中；或者直接复制cas-server-webapp/target/cas-server-webapp-3.4.10目录到tomcat/webapp目录下，其他步骤和上面一样</p>
</blockquote>
<h3>七、CAS服务器深入配置</h3>
<p>上面的初体验仅仅是简单的身份验证，实际应用中肯定是要读取数据库的数据，下面我们来进一步配置CAS服务器怎么读取数据库的信息进行身份验证。<br />
首先打开tomcat/webapp/cas/WEB-INF/deployerConfigContext.xml文件，配置的地方如下：</p>
<ol>
<li>找到第92行处，注释掉：SimpleTestUsernamePasswordAuthenticationHandler这个验证Handler，这个是比较简单的，只是判断用户名和密码相同即可通过，这个肯定不能在实际应用中使用，弃用！</li>
<li>注释掉92行后在下面添加下面的代码：

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sql&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;select password from t_admin_user where login_name=?&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;passwordEncoder&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;MD5PasswordEncoder&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>在文件的末尾</beans>之前加入如下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;driverClassName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.mysql.jdbc.Driver<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;url&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdbc:mysql:///wsriademo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;username&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>root<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;password&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>root<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;MD5PasswordEncoder&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.jasig.cas.authentication.handler.DefaultPasswordEncoder&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constructor-arg</span> <span style="color: #000066;">index</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>MD5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/constructor-arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</li>
<li>复制cas-server-3.4.3.1\modules\cas-server-support-jdbc-3.4.3.1.jar和mysql驱动jar包到tomcat/webapp/cas/WEB-INF/lib目录</li>
<li>配置解释：
<ul>
<li><strong>QueryDatabaseAuthenticationHandler</strong>是cas-server-support-jdbc提供的查询接口其中一个，QueryDatabaseAuthenticationHandler是通过配置一个 SQL 语句查出密码，与所给密码匹配</li>
<li><strong>dataSource</strong>我就不用解释了吧，就是使用JDBC查询时的数据源</li>
<li><strong>sql</strong>语句就是查询哪一张表，本例根据t_admin_user表的login_name字段查询密码，CAS会匹配用户输入的密码，如果匹配则通过；下面是t_admin_user的表结构：

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> t_admin_user <span style="color: #66cc66;">&#40;</span>
	id <span style="color: #993333; font-weight: bold;">BIGINT</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	email <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	login_name <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">UNIQUE</span><span style="color: #66cc66;">,</span>
	name <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	password <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>InnoDB;</pre></div></div>

</li>
<li><strong>passwordEncoder</strong>，这个就算是自己加的盐巴了，意思很明显就是处理密码的加密，看你的应用中数据库保存的是明码还是加密过的，比如本例是使用MD5加密的，所以配置了MD5PasswordEncoder这个Handler，cas内置了MD5的功能所以只需要配置一下就可以了；如果在实际应用中使用的是公司自己的加密算法那么就需要自己写一个Handler来处理密码，实现方式也比较简单，创建一个类继承org.jasig.cas.authentication.handler.PasswordEncoder然后在encode方法中加密用户输入的密码然后返回即可</li>
</ul>
</li>
</ol>
<h3>八、配置CAS客户端</h3>
<ol>
<li><strong>添加cas-client的jar包</strong>，有两种方式：
<ul>
<li><strong>传统型</strong>：下载cas-client，地址：<a href="http://www.ja-sig.org/downloads/cas-clients/" target="_blank">http://www.ja-sig.org/downloads/cas-clients/</a>，然后解压cas-client-3.1.12.zip，在modules文件夹中有需要的jar包，请根据自己的项目情况选择使用<br />
<blockquote><p><strong>2011-11-05更新：</strong>3.2.1版本（只有源码的情况，包含maven的pom.xml），和用maven打包server的方式一样，在cas-client-3.2.1目录中运行命令：mvn package -pl cas-client-core -DskipTests=true<br/><br />
然后从target目录中复制cas-client-core-3.2.1.jar到应用的WEB-INF/lib目录中
</li>
<li><strong><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>型</strong>：

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- cas --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jasig.cas.client<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>cas-client-core<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3.1.12<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</li>
</ul>
</li>
<li><strong>设置filter</strong><br />
先上配置信息：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- 用于单点退出，该过滤器用于实现单点登出功能，可选配置--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jasig.cas.client.session.SingleSignOutHttpSessionListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- 该过滤器用于实现单点登出功能，可选配置。 --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS Single Sign Out Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jasig.cas.client.session.SingleSignOutFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS Single Sign Out Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- 该过滤器负责用户的认证工作，必须启用它 --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CASFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jasig.cas.client.authentication.AuthenticationFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>casServerLoginUrl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>https://sso.wsria.com:8443/cas/login<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #808080; font-style: italic;">&lt;!--这里的server是服务端的IP--&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>serverName<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://localhost:10000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CASFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- 该过滤器负责对Ticket的校验工作，必须启用它 --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS Validation Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>casServerUrlPrefix<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>https://sso.wsria.com:8443/cas<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>serverName<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://localhost:10000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS Validation Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">	该过滤器负责实现HttpServletRequest请求的包裹，</span>
<span style="color: #808080; font-style: italic;">	比如允许开发者通过HttpServletRequest的getRemoteUser()方法获得SSO登录用户的登录名，可选配置。</span>
<span style="color: #808080; font-style: italic;">--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS HttpServletRequest Wrapper Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		org.jasig.cas.client.util.HttpServletRequestWrapperFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS HttpServletRequest Wrapper Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">	该过滤器使得开发者可以通过org.jasig.cas.client.util.AssertionHolder来获取用户的登录名。</span>
<span style="color: #808080; font-style: italic;">	比如AssertionHolder.getAssertion().getPrincipal().getName()。</span>
<span style="color: #808080; font-style: italic;">--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS Assertion Thread Local Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jasig.cas.client.util.AssertionThreadLocalFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CAS Assertion Thread Local Filter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- 自动根据单点登录的结果设置本系统的用户信息 --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AutoSetUserAdapterFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AutoSetUserAdapterFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.wsria.demo.filter.AutoSetUserAdapterFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AutoSetUserAdapterFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- ======================== 单点登录结束 ======================== --&gt;</span></pre></div></div>

<p>每个Filter的功能我就不多说了，都有注释的，关键要解释一下AutoSetUserAdapterFilter的作用和原理.<br />
查看完整的web.xml请<a href="http://code.google.com/p/wsria/source/browse/branches/wsria-demo-sso/src/main/webapp/WEB-INF/web.xml" target="_blank">猛击这里</a>(Google code)
        </li>
<li>利用AutoSetUserAdapterFilter<strong>自动根据CAS信息设置Session的用户信息</strong>：<br />
先看一下这个<a href="http://code.google.com/p/wsria/source/browse/branches/wsria-demo-sso/src/main/java/com/wsria/demo/filter/AutoSetUserAdapterFilter.java" target="_blank">Filter的源码</a>：<br />
好的，如果你是老程序员应该很快就清楚Filter的目的，如果不太懂我再讲解一下；<br />
主要是通过CAS的<strong>_const_cas_assertion_</strong>获取从CAS服务器登陆的用户名，然后再根据系统内部的用户工具（<a href="http://code.google.com/p/wsria/source/browse/branches/wsria-demo-sso/src/main/java/com/wsria/demo/util/UserUtil.java" target="_blank">UserUtil.java</a>）来判断是否已经登录过，如果没有登录根据登录名从数据库查询用户信息，最后使用设置把用户信息设置到当前session中。<br />
这样就把用户信息保存到了Sessino中，我们就可以通过UserUtil工具来获取当前登录的用户了，我在实例项目中也加入了此功能演示，请看代码：<a href="http://code.google.com/p/wsria/source/browse/branches/wsria-demo-sso/src/main/webapp/WEB-INF/content/main/main.jsp">main.jsp</a>的第44行处
        </li>
<li><strong>补充一下</strong>：如果是为一个老项目添加单点登录功能，那么基本不需要其他的修改，设置好上面的filter即可；当然最好获取用户信息的地方都调用一个工具类，统一管理不容易出错。</li>
</ol>
<h3>九、美化CAS服务器界面</h3>
<p>CAS服务端(cas-server)的界面只能在测试的时候用一下，真正系统上线肯定需要定制开发自己的页面，就想<a href="http://reg.163.com/" target="_blank">网易</a>和<a href="http://passport.csdn.net/UserLogin.aspx" target="_blank">CSDN</a>的统一认证平台一样，所有子系统的认证都通过此平台来转接，大家可以根据他们的页面自己定制出适合所属应用或者公司的界面；简单介绍一下吧，复制cas\WEB-INF\view\jsp\default\ui的一些JSP文件，每一个文件的用途文件名已经区分了，自己修改了替换一下就可以了。<br />
例如：<br />
登录界面：casLoginView.jsp<br />
登录成功：casGenericSuccess.jsp<br />
登出界面：casLogoutView.jsp</p>
<h3>十、结束语</h3>
<p>花了一下午时间终于写完了，总共十项也算完美了。<br />
现在看来起始利用CAS实现单点登录其实不难，不要畏惧，更不要排斥！<br />
本教程后面的代码部分均来自<a href="http://www.wsria.com" target="_blank">本博客</a>的<a href="http://code.google.com/p/wsria/" target="_blank">wsria-demo</a>项目分支<a href="http://code.google.com/p/wsria/source/browse/#svn/branches/wsria-demo-sso" target="_blank">wsria-demo-sso</a><br />
<strong>和本教程相关资料下载</strong>：</p>
<ol>
<li>本教程使用的演示程序，点击<a href="http://code.google.com/p/wsria/downloads/detail?name=wsria-demo-sso-1.0.0.war&#038;can=2&#038;q=#makechanges" target="_blank">这里</a>下载</li>
<li>使用keytool生成的key和证书，点击<a href="http://code.google.com/p/wsria/downloads/detail?name=wsria-demo-sso-keys.zip&#038;can=2&#038;q=#makechanges" target="_blank">这里</a>下载</li>
</ol>
<p>到此本教程全部结束，希望看完后对你有帮助，如果有帮助还望继续推荐给其他人，有说明意见或者问题请回复或者IM联系我。</p>
<h3>十一、疑难问题 </h3>
<p>如果遇到了意料之外的问题请参考文章的评论部分，或许能找到问题的原因以及解决办法！</p>
<ol>
<li><b>javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching casserver found</b><br />
<blockquote>
<p>由于创建证书的域名和在应用中配置的cas服务域名不一致导致以下错误</p>
<p>详细请参考：<a href="https://gist.github.com/1717087" target="_blank" title="https://gist.github.com/1717087">https://gist.github.com/1717087</a>
</p></blockquote>
</ol>
<h3>十二、更新记录_2011-11-05</h3>
<p>整整一年之后因为需要为客户搭建CAS换季再次更新本文章，不知道碰巧呢碰巧呢还是碰巧呢，反正就是11.5号了……<br />
在这里还要感谢大家对我的支持，要不然这篇教程也不会一直处于本博客的第一位……
</p>
<p>不知道从哪个版本开始cas全面使用了maven构建项目，所以需要安装<a href="http://maven.apache.org/index.html" title="apache maven" target="_blank">apache maven</a>工具来构建源码，下面step by step讲解如何构建（面向没有接触过maven的童鞋）</p>
<ul>
<li><strong>下载Maven：</strong>打开<a href="http://maven.apache.org/download.html" title="http://maven.apache.org/download.html" target="_blank"></a>后下载对应的包，windows用户请下载<strong>Binary zip</strong>格式的压缩包，linux或者unix用户请下载<strong>Binary tar.gz</strong>格式的压缩包</li>
<li><strong>安装、配置Maven：</strong>解压压缩包到一个目录，例如/home/kafeitu/tools/apache/apache-maven-3.0.3，然后设置系统环境变量<strong>M3_HOME</strong>=/home/kafeitu/tools/apache/apache-maven-3.0.3，在PAT变量中添加路径，<strong>windows用户：</strong>;%M3_HOME%/bin，<strong>Linux用户：</strong>在.bashrc或者/et/profile文件中找到PATH，添加:$M3_HOME/bin</li>
<li><strong>验证安装：</strong>重新打开一个命令窗口(linux用户可以运行：. .bashrc或者. /etc/profile)，在cmd或者shell中进入解压的cas server目录后运行:mvn -version后如果看到打印系统信息和maven版本信息后证明配置ok</li>
</ul>
<h3>十三、更新记录_2011-11-18</h3>
<p>你也可以申请免费的StartSSL CA证书:<br />
StartSSL(公司名：StartCom)也是一家CA机构，它的根证书很久之前就被一些具有开源背景的浏览器支持(Firefox浏览器、谷歌Chrome浏览器、苹果Safari浏览器等)。<br />
申请地址：http://www.startssl.com<br />
申请方法参考：http://www.linuxidc.com/Linux/2011-11/47478.htm</p>
<h3>十四、参考资料</h3>
<p><a href="https://wiki.jasig.org/display/CASUM/Home" title="https://wiki.jasig.org/display/CASUM/Home">Jasig WIKI: CAS user Manual</a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1349">CAS单点登录(SSO)完整教程(2012-02-01更新)</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/java" title="查看 Java 中所有文章" target="_blank">Java</a></span>和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1349&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1349/feed</wfw:commentRss>
		<slash:comments>77</slash:comments>
		</item>
		<item>
		<title>maven-war-plugin插件的warSourceExcludes和packagingExcludes参数的区别</title>
		<link>http://www.wsria.com/archives/1335</link>
		<comments>http://www.wsria.com/archives/1335#comments</comments>
		<pubDate>Wed, 03 Nov 2010 02:25:13 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[后台技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1335</guid>
		<description><![CDATA[warSourceExcludes和packagingExcludes的区别<p class="read-more"><a href="http://www.wsria.com/archives/1335">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>项目中在打包的时候时常要忽略一些只在本地使用的文件，比如一些test文件夹或者本地配置，刚刚开始使用maven-war-plugin的warSourceExcludes和packagingExcludes这两个参数还真是搞得有点晕，多试验了几次明白了，现在分享一下我的理解。</p>
<p>引用官网的说明：</p>
<blockquote>
<table>
<tbody>
<tr>
<td><strong><a href="http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#warSourceExcludes">warSourceExcludes</a></strong></td>
<td><code>String</code></td>
<td><code>-</code></td>
<td>The comma separated list of tokens to exclude when?copying the content?of the warSourceDirectory.</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><strong><a href="http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#packagingExcludes">packagingExcludes</a></strong></td>
<td><code>String</code></td>
<td><code>2.1-alpha-2</code></td>
<td>The comma separated list of tokens to?exclude from the WAR before packaging. This option may be used to implement?the skinny?WAR use case.</td>
</tr>
</tbody>
</table>
</blockquote>
<div>引用我负责的一个项目对maven-war-plugin的配置：</div>
<blockquote>
<div>&lt;packagingExcludes&gt;**/application*.properties,**/spy.properties&lt;/packagingExcludes&gt;<br />
&lt;warSourceExcludes&gt;test/*,venue/**&lt;/warSourceExcludes&gt;</div>
</blockquote>
<blockquote>
<div>声明：packagingExcludes中的*.properties文件均位于src/main/resources目录中<br />
warSourceExcludes中的?test/*,venue/**位于src/main/webapp目录中</div>
</blockquote>
<div>运行mvn package命令后结果是：</div>
<div>
<ol>
<li>target/mywebapp-1.0.4 (文件夹)下面原码中存在的test和venue目录没有复制过来（warSourceExcludes忽略成功），其他的文件和目录没有变化</li>
<li>对于packagingExcludes的配置意思是从mywebapp-1.0.4文件夹中复制文件时忽略的文件列表，所以最后打包的war里面不包含test、venue文件夹和packagingExcludes中指定的文件</li>
</ol>
<h3>简单一句话说明：</h3>
<blockquote>
<div>warSourceExcludes是在编译周期进行完成后从src/main/webapp目录复制文件时忽略，而packagingExcludes是在复制webapp目录完成后打包时忽略target/mywebapp-1.0.4 文件夹的文件</div>
</blockquote>
</div>
<h3>说明：</h3>
<p>这里使用了warSourceExcludes和packagingExcludes两个参数为的就是演示一下含义，比如在打包产品的时候完全可以使用warSourceExcludes这一个参数来忽略文件，这样就可以省略packagingExcludes这个参数了
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1335">maven-war-plugin插件的warSourceExcludes和packagingExcludes参数的区别</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1335&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1335/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>公布一下我的Evernote分享地址</title>
		<link>http://www.wsria.com/archives/1331</link>
		<comments>http://www.wsria.com/archives/1331#comments</comments>
		<pubDate>Wed, 03 Nov 2010 01:47:58 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Evernote]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1331</guid>
		<description><![CDATA[不知道Evernote是什么玩意自己查；我的账号是去年注册的，今年才开始使用，平常记录了一些技术方面的资料，和大家分享一下，或许能有用。 我一共分享了4个分类： 开发技术：http://www.evernote.com/pub/yanhonglei/dev-tech 操作系统：http://www.evernote.com/pub/yanhonglei/os 软件使用：http://www.evernote.com/pub/yanhonglei/software-usage 各种杂文：http://www.evernote.com/pub/yanhonglei/mixed 如果你也有Evernote账号可以把我的共享加入到你的Link里面，方法：http://www.evernote.com/pub/ensupport/faq#n=e8e05ff3-dc47-4da1-83cf-eb6774eb70c8 最后推荐一个Chrome的Evernote插件，非常方便，平常遇到的问题Google的结果可以直接发送Evernote笔记本里面，插件地址：https://chrome.google.com/extensions/detail/pioclpoplcdbaefihamjohnefbikjilc 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: 公布一下我的Evernote分享地址]]></description>
			<content:encoded><![CDATA[<p>不知道<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/evernote" title="查看 Evernote 中所有文章" target="_blank">Evernote</a></span>是什么玩意自己查；我的账号是去年注册的，今年才开始使用，平常记录了一些技术方面的资料，和大家分享一下，或许能有用。</p>
<p>我一共分享了4个分类：</p>
<ol>
<li>开发技术：<a href="http://www.evernote.com/pub/yanhonglei/dev-tech">http://www.evernote.com/pub/yanhonglei/dev-tech</a></li>
<li>操作系统：<a href="http://www.evernote.com/pub/yanhonglei/os">http://www.evernote.com/pub/yanhonglei/os</a></li>
<li>软件使用：<a href="http://www.evernote.com/pub/yanhonglei/software-usage">http://www.evernote.com/pub/yanhonglei/software-usage</a></li>
<li>各种杂文：<a href="http://www.evernote.com/pub/yanhonglei/mixed">http://www.evernote.com/pub/yanhonglei/mixed</a></li>
</ol>
<p>如果你也有<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/evernote" title="查看 Evernote 中所有文章" target="_blank">Evernote</a></span>账号可以把我的共享加入到你的Link里面，方法：<a href="http://www.evernote.com/pub/ensupport/faq#n=e8e05ff3-dc47-4da1-83cf-eb6774eb70c8">http://www.evernote.com/pub/ensupport/faq#n=e8e05ff3-dc47-4da1-83cf-eb6774eb70c8</a></p>
<p>最后推荐一个<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/chrome" title="查看 Chrome 中所有文章" target="_blank">Chrome</a></span>的Evernote<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e6%8f%92%e4%bb%b6" title="查看 插件 中所有文章" target="_blank">插件</a></span>，非常方便，平常遇到的问题Google的结果可以直接发送Evernote笔记本里面，<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e6%8f%92%e4%bb%b6" title="查看 插件 中所有文章" target="_blank">插件</a></span>地址：<a href="https://chrome.google.com/extensions/detail/pioclpoplcdbaefihamjohnefbikjilc">https://chrome.google.com/extensions/detail/pioclpoplcdbaefihamjohnefbikjilc</a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1331">公布一下我的Evernote分享地址</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1331&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1331/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Maven常见问题收集（持续更新-2010-12-15）</title>
		<link>http://www.wsria.com/archives/1314</link>
		<comments>http://www.wsria.com/archives/1314#comments</comments>
		<pubDate>Mon, 01 Nov 2010 13:15:00 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[后台技术]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[解决方案]]></category>
		<category><![CDATA[转载]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1314</guid>
		<description><![CDATA[一、Maven狂热者-Jdonee收集的问题(2010-11-01) Maven常见问题解答(一) Maven常见问题解答(二) Maven常见问题解答(三) PS：之前由于文章是发布在Jdonee的Javaeye博客上的，后来转移到独立博客了导致大家不能访问。(Update Date：2010-11-07) 二、咖啡兔收集的Maven问题 maven-war-plugin插件的warSourceExcludes和packagingExcludes参数的区别 三、avajava-Maven Tutorials 里面讲解了一些日常开发中遇到过的问题，配有图片说明，只不过是英文的，但是都是一些日常的技术术语比较好理解，地址分享： http://www.avajava.com/tutorials/categories/maven 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: Maven常见问题收集（持续更新-2010-12-15）]]></description>
			<content:encoded><![CDATA[<h3>一、<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>狂热者-Jdonee收集的问题(2010-11-01)</h3>
<ol>
<li><a href="http://www.jdonee.com/2010/11/05/maven-usually-qa-1/">Maven常见问题解答(一)</a></li>
<li><a href="http://www.jdonee.com/2010/11/05/maven-usually-qa-2/">Maven常见问题解答(二)</a></li>
<li><a href="http://www.jdonee.com/2010/11/06/maven-usually-qa-3/">Maven常见问题解答(三)</a></li>
</ol>
<p>PS：之前由于文章是发布在Jdonee的<a href="http://jdonee.javaeye.com/" target="_blank">Javaeye博客</a>上的，后来转移到<a href="http://www.jdonee.com/" target="_blank">独立博客</a>了导致大家不能访问。(Update Date：2010-11-07)</p>
<h3>二、咖啡兔收集的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>问题</h3>
<ol>
<li><a href="http://www.wsria.com/archives/1335">maven-war-plugin插件的warSourceExcludes和packagingExcludes参数的区别</a></li>
</ol>
<h3>三、avajava-Maven Tutorials</h3>
<p>里面讲解了一些日常开发中遇到过的问题，配有图片说明，只不过是英文的，但是都是一些日常的技术术语比较好理解，地址分享：<br />
<a href="http://www.avajava.com/tutorials/categories/maven" target="_blank">http://www.avajava.com/tutorials/categories/maven</a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1314">Maven常见问题收集（持续更新-2010-12-15）</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1314&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1314/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>本博客启用新域名www.wsria.com</title>
		<link>http://www.wsria.com/archives/1296</link>
		<comments>http://www.wsria.com/archives/1296#comments</comments>
		<pubDate>Mon, 01 Nov 2010 12:47:22 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[博客公告]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[皮蛋]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1296</guid>
		<description><![CDATA[由于wsria.com到明年2.6号到期，我在今年5月份购买了wsria.com域名，由于一直忙也没有更换，今天和一个朋友聊天的时候他说建议让我启用，只要设置301跳转就可以了……好吧；接下来还是比较麻烦的，因为博客的设置问题导致301跳转失败，最后不得不让他全力配合了…… 原来的wsria.com还是可以继续访问，主页已改为了：wsria.com，对于大家没有什么影响，希望大家记住新域名： 请记住新域名：www.wsria.com 你记住了吗？OK，就是它！ 我还是会一如既往的分享一些文章给大家。 RSS地址更新 http://feed.wsria.com/ 特别感谢 本次域名设置特别感谢在WCC2009认识的皮蛋的全力支持！现在皮蛋已经创立了自己的公司，主营业务包括：网站开发、手机软件等，皮蛋现在正在招人…… 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: 本博客启用新域名www.wsria.com]]></description>
			<content:encoded><![CDATA[<p>由于wsria.com到明年2.6号到期，我在今年5月份购买了wsria.com域名，由于一直忙也没有更换，今天和一个朋友聊天的时候他说建议让我启用，只要设置301跳转就可以了……好吧；接下来还是比较麻烦的，因为<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e5%8d%9a%e5%ae%a2" title="查看 博客 中所有文章" target="_blank">博客</a></span>的设置问题导致301跳转失败，最后不得不让他全力配合了……</p>
<p>原来的wsria.com还是可以继续访问，主页已改为了：wsria.com，对于大家没有什么影响，希望大家记住新域名：</p>
<blockquote>
<div style="font-size: 20pt;">请记住新域名：<strong><a href="http://www.wsria.com">www.wsria.com</a></strong></div>
</blockquote>
<blockquote>
<div style="font-size: 15pt;"><strong>你记住了吗？</strong>OK，就是它！</div>
</blockquote>
<p>我还是会一如既往的分享一些文章给大家。</p>
<h3>RSS地址更新</h3>
<blockquote><p><a href="http://feed.wsria.com/">http://feed.wsria.com/</a></p></blockquote>
<h3>特别感谢</h3>
<p>本次域名设置特别感谢在WCC2009认识的<a href="http://wufendi.com">皮蛋</a>的全力支持！现在<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e7%9a%ae%e8%9b%8b" title="查看 皮蛋 中所有文章" target="_blank">皮蛋</a></span>已经创立了自己的公司，主营业务包括：网站开发、手机软件等，<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e7%9a%ae%e8%9b%8b" title="查看 皮蛋 中所有文章" target="_blank">皮蛋</a></span>现在正在招人……
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1296">本博客启用新域名www.wsria.com</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1296&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1296/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>《Maven实战》最新消息，11月初出版</title>
		<link>http://www.wsria.com/archives/1288</link>
		<comments>http://www.wsria.com/archives/1288#comments</comments>
		<pubDate>Wed, 27 Oct 2010 09:10:22 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[业界动态]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[Juven]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[图书]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1288</guid>
		<description><![CDATA[千呼万唤始出来，真是不易，等了近2个月，最新消息《Maven实战》定于11月初出版。 大图尝鲜： 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: 《Maven实战》最新消息，11月初出版]]></description>
			<content:encoded><![CDATA[<p>千呼万唤始出来，真是不易，等了近2个月，最新消息《<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>实战》定于11月初出版。<br />
大图尝鲜：<br />
<a href="http://www.wsria.com/wp-content/uploads/2010/10/maven-in-action.jpg" rel="lightbox[1288]" title="maven in action"><img src="http://www.wsria.com/wp-content/uploads/2010/10/maven-in-action.jpg" alt="" title="maven in action" width="661" height="858" class="alignleft size-full wp-image-1289" /></a>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1288">《Maven实战》最新消息，11月初出版</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1288&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1288/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery.validate插件remote规则相同值不验证的问题解决办法</title>
		<link>http://www.wsria.com/archives/1273</link>
		<comments>http://www.wsria.com/archives/1273#comments</comments>
		<pubDate>Mon, 25 Oct 2010 15:36:22 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[个人作品]]></category>
		<category><![CDATA[前端技术]]></category>
		<category><![CDATA[解决方案]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[validate]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1273</guid>
		<description><![CDATA[一、由来说明 使用jquery.validate插件的remote规则来验证一组参数是否重复，我的需求不像其他应用一样只验证一个字段是否重复，而是要依赖其他的几个字段来组合判断，所以jquery.validate就有点水土不服了。 二、环境说明 jQuery validation版本号： jQuery validation plug-in 1.7 $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ 三、实例说明 见左图，要保证[会员等级]和[积分来源]的联合唯一，类似于数据库的联合主键。 验证代码片段： remote: &#123; url: &#34;split-account-rule!checkRepeat.action&#34;, type: &#34;post&#34;, cache: false, dataType:&#34;json&#34;, data: &#123; newId : function&#40;&#41; &#123; return $&#40;&#34;#id_g&#34;&#41;.val&#40;&#41;; &#125;, memberLevel: function&#40;&#41; &#123; &#8230;<p class="read-more"><a href="http://www.wsria.com/archives/1273">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h3>一、由来说明</h3>
<p>使用jquery.<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/validate" title="查看 validate 中所有文章" target="_blank">validate</a></span>插件的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/remote" title="查看 remote 中所有文章" target="_blank">remote</a></span>规则来验证一组参数是否重复，我的需求不像其他应用一样只验证一个字段是否重复，而是要依赖其他的几个字段来组合判断，所以jquery.<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/validate" title="查看 validate 中所有文章" target="_blank">validate</a></span>就有点水土不服了。</p>
<h3>二、环境说明</h3>
<p><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jquery" title="查看 jQuery 中所有文章" target="_blank">jQuery</a></span> validation版本号： <span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jquery" title="查看 jQuery 中所有文章" target="_blank">jQuery</a></span> validation plug-in 1.7<br />
$Id: jquery.<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/validate" title="查看 validate 中所有文章" target="_blank">validate</a></span>.js 6403 2009-06-17 14:27:16Z joern.zaefferer $</p>
<h3>三、实例说明</h3>
<div id="attachment_1276" class="wp-caption aligncenter" style="width: 461px"><a href="http://www.wsria.com/wp-content/uploads/2010/10/1.gif" rel="lightbox[1273]" title="1"><img class="size-medium wp-image-1276" title="1" src="http://www.wsria.com/wp-content/uploads/2010/10/1.gif" alt="" width="451" height="269" /></a><p class="wp-caption-text">验证规则功能说明(图一)</p></div>
<p>见左图，要保证[会员等级]和[积分来源]的联合唯一，类似于数据库的联合主键。</p>
<p>验证代码片段：<br />
<span id="more-1273"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">remote<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
	url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;split-account-rule!checkRepeat.action&quot;</span><span style="color: #339933;">,</span>
	type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;post&quot;</span><span style="color: #339933;">,</span>
	cache<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	dataType<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;json&quot;</span><span style="color: #339933;">,</span>
	data<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		newId <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#id_g&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		memberLevel<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#level&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		pointSource<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#source'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>很明显现在输入了【会员等级】为1，和列表中已存在的数据重复了。</p>
<p>好的，那么我们看看另外一种结果；</p>
<div id="attachment_1278" class="wp-caption aligncenter" style="width: 468px"><a href="http://www.wsria.com/wp-content/uploads/2010/10/2.gif" rel="lightbox[1273]" title="2"><img class="size-medium wp-image-1278" title="2" src="http://www.wsria.com/wp-content/uploads/2010/10/2.gif" alt="" width="458" height="275" /></a><p class="wp-caption-text">规则验证正确(图二)</p></div>
<p>现在我们看到【图二】中输入了【会员等级】为2，积分来源还是【联名银行卡】，现在的结果是没有重复的，那么再看另外一种情况；</p>
<p><div id="attachment_1281" class="wp-caption aligncenter" style="width: 471px"><a href="http://www.wsria.com/wp-content/uploads/2010/10/3.gif" rel="lightbox[1273]" title="3"><img class="size-full wp-image-1281" title="3" src="http://www.wsria.com/wp-content/uploads/2010/10/3.gif" alt="" width="461" height="295" /></a><p class="wp-caption-text">这次出错了……(图三)</p></div><br />
这次出错了吧，列表中根本不存在等级为1和积分来源为【线上商城】的记录，为什么会重复呢？我的操作方式是在图一的基础上选择【积分来源】为”线上商城“，然后点击”提交“按钮；</p>
<h3>四、解决问题</h3>
<p>问题找出来了，那么怎么解决呢……我的经验是Google无果后直接看源码分析问题的原因；<br />
然后查看源码中<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/remote" title="查看 remote 中所有文章" target="_blank">remote</a></span>函数的具体操作，发现了问题的所在，大家可以查看第932行处：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>932
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> previous.<span style="color: #660066;">old</span> <span style="color: #339933;">!==</span> value <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></td></tr></table></div>

<p>哦，原来妖怪在这里，如果第一次验证失败后更改验证条件后再次校验就处问题了，因为这里判断了本次的值和上一次出错的值是否一样，如果一样直接返回上次的验证错误信息；难怪我验证不通过……<br />
那要想一个办法跳过这里，但是要温柔一点，做快捷的办法是给插件加入一个参数来忽略相同值的验证，也就是说当第一次验证失败后更改了验证依赖条件再次验证时忽略相同值的判断而直接再次请求后台验证；<br />
所以我加入了一个<b>ignoreSameValue</b>参数来实现我的想法，更改第932行代码如下：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>932
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> previous.<span style="color: #660066;">old</span> <span style="color: #339933;">!==</span> value <span style="color: #339933;">||</span> param.<span style="color: #660066;">ignoreSameValue</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></td></tr></table></div>

<p>然后再remote验证调用的代码处设置参数为true即可，</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">remote<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
	url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;split-account-rule!checkRepeat.action&quot;</span><span style="color: #339933;">,</span>
	ignoreSameValue<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
	type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;post&quot;</span><span style="color: #339933;">,</span>
	cache<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	dataType<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;json&quot;</span><span style="color: #339933;">,</span>
	data<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		newId <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#id_g&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		memberLevel<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#level&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		pointSource<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#source'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>现在再次测试验证通过了，有图为证<div id="attachment_1282" class="wp-caption aligncenter" style="width: 457px"><a href="http://www.wsria.com/wp-content/uploads/2010/10/4.gif" rel="lightbox[1273]" title="4"><img src="http://www.wsria.com/wp-content/uploads/2010/10/4.gif" alt="" title="4" width="447" height="287" class="size-full wp-image-1282" /></a><p class="wp-caption-text">添加了参数后验证通过了</p></div>
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1273">jquery.validate插件remote规则相同值不验证的问题解决办法</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jquery" title="查看 jQuery 中所有文章" target="_blank">jQuery</a></span>开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1273&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1273/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>城市级联选择插件jquery.area2select闪亮登场(前后台设计)</title>
		<link>http://www.wsria.com/archives/1237</link>
		<comments>http://www.wsria.com/archives/1237#comments</comments>
		<pubDate>Mon, 18 Oct 2010 13:16:42 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[个人作品]]></category>
		<category><![CDATA[前端技术]]></category>
		<category><![CDATA[后台技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[软件设计]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[area2select]]></category>
		<category><![CDATA[jQuery插件]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[SpringSide]]></category>
		<category><![CDATA[源码]]></category>
		<category><![CDATA[级联]]></category>

		<guid isPermaLink="false">http://www.wsria.com/?p=1237</guid>
		<description><![CDATA[城市级联选择插件jquery.area2select闪亮登场(前后台设计)<p class="read-more"><a href="http://www.wsria.com/archives/1237">继续阅读 &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>公司的一个二期项目需要使用地区信息的<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e7%ba%a7%e8%81%94" title="查看 级联 中所有文章" target="_blank">级联</a></span>选择功能，因为本来有数据库设计所以就根据数据库设计构建了本次要发布的插件：jquery.<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/area2select" title="查看 area2select 中所有文章" target="_blank">area2select</a></span>，算是真正意义上的第一个<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jqueryplugin" title="查看 jQuery插件 中所有文章" target="_blank">jQuery插件</a></span>吧。<br />
插件的开发目的一是为了公司的项目试用，另外一个就是把各种我平常开发积累的东西分享给大家，也就是我创建的<a href="http://code.google.com/p/wsria/" target="_blank">wsria</a>项目。</p>
<h3>一、文档以及API</h3>
<p>如果看着累直接点击<a href="http://www.wsria.com/demo/plugins/area2select/area-plugin-caption.html" target="_blank"><strong>这里</strong></a>，在新窗口打开。</p>
<h3>二、配套演示地址</h3>
<p>因为是和后台配合使用，所以专门搭建了一个部署在tomcat上的演示程序；<br />
<strong>演示地址：</strong><a href="http://kafeitu.gicp.net:10000/demo" target="_blank">http://kafeitu.gicp.net:10000/demo</a>，进入页面后在<strong>左侧</strong>的“地区信息”栏目中。<br />
<span id="more-1237"></span></p>
<h3>三、插件<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/%e6%ba%90%e7%a0%81" title="查看 源码 中所有文章" target="_blank">源码</a></span>相关下载</h3>
<ol>
<li><strong>发布版本</strong>：<a href="http://code.google.com/p/wsria/downloads/list" target="_blank">http://code.google.com/p/wsria/downloads/list</a></li>
<li><strong>SVN最新版本</strong>：<br />
请用SVN客户端检出或导出仓库：http://wsria.googlecode.com/svn/trunk/</li>
</ol>
<h3>四、下载后的配置说明：</h3>
<ol>
<li>自己搞一个tomcat，把war包放在tomcat的webapp目录中；然后在<strong>D盘</strong>下建立<strong>wsria-demo</strong>文件夹，war的WEB-INF/classes/applicationContext.xml中中默认配置了两个本地数据库配置文件，即：<br />
<strong>Windows</strong>：d:/wsria-demo/application.properties<br />
<strong>Linux</strong>：var/wsria-demo/application.properties</p>
<p>在wsria-demo文件夹中配置你本地的数据库，请参考：<br />
<a href="http://code.google.com/p/wsria/source/browse/tags/demo-1.0.2/src/main/resources/application.properties" target="_blank">http://code.google.com/p/wsria/source/browse/tags/demo-1.0.2/src/main/resources/application.properties</a><br />
你需要修改的是17、18、19行的配置，主要是修改本地mysql的数据库名称和用户名密码</li>
<li>接下来把sql脚本导入到你的数据库中，脚本在<a href="http://code.google.com/p/wsria/source/browse/#svn/repository/1.0.2" target="_blank">http://code.google.com/p/wsria/source/browse/#svn/repository/1.0.2</a>的wsria-demo-1.0.2.sql中</li>
</ol>
<p>现在你可以运行你的TOMCAT了，如果你本地有<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/maven" title="查看 Maven 中所有文章" target="_blank">Maven</a></span>环境也可以直接用mvn jetty:run命令运行。
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1237">城市级联选择插件jquery.area2select闪亮登场(前后台设计)</a></p>
</div>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jquery" title="查看 jQuery 中所有文章" target="_blank">jQuery</a></span>开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1237&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1237/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JHOST邀请码一枚：20101118203211_721542 JHOST是提&#8230;</title>
		<link>http://www.wsria.com/archives/1238</link>
		<comments>http://www.wsria.com/archives/1238#comments</comments>
		<pubDate>Mon, 18 Oct 2010 12:43:24 +0000</pubDate>
		<dc:creator>咖啡兔</dc:creator>
				<category><![CDATA[status]]></category>
		<category><![CDATA[JHOST]]></category>

		<guid isPermaLink="false">http://www.wsria.com/archives/1238</guid>
		<description><![CDATA[JHOST邀请码一枚：20101118203211_721542 JHOST是提供免费Java空间的服务商，我正在搭建和本博客配套的演示，先给大家分享一下 网址：www.jhost.cn 原创文章，转载请注明： 转载自what is the RIA? just it…&#124;&#124;咖啡兔 本文链接地址: JHOST邀请码一枚：20101118203211_721542 JHOST是提&#8230;]]></description>
			<content:encoded><![CDATA[<p><span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jhost" title="查看 JHOST 中所有文章" target="_blank">JHOST</a></span>邀请码一枚：20101118203211_721542<br />
<span class='wp_keywordlink_affiliate'><a href="http://www.wsria.com/archives/tag/jhost" title="查看 JHOST 中所有文章" target="_blank">JHOST</a></span>是提供免费Java空间的服务商，我正在搭建和本博客配套的演示，先给大家分享一下<br />
网址：www.jhost.cn
<div style="margin-top: 15px; font-style: italic">
<p><strong>原创文章，转载请注明：</strong> 转载自<a href="http://www.wsria.com/">what is the RIA?  just it…||咖啡兔</a></p>
<p><strong>本文链接地址:</strong> <a href="http://www.wsria.com/archives/1238">JHOST邀请码一枚：20101118203211_721542 JHOST是提&#8230;</a></p>
</div>
<p style="margin:0;padding:0;height:1px;overflow:hidden;">
    <script type="text/javascript"><!--
        var wumiiSitePrefix = "http://www.wsria.com";
        var wumiiEnableCustomPos = false;
        var wumiiParams = "&#038;num=5&#038;mode=3&#038;displayInFeed=1&#038;version=1.0.5.5&#038;pf=WordPress3.2";
    //--></script><script type="text/javascript" src="http://widget.wumii.com/ext/relatedItemsWidget.htm"></script><a href="http://www.wumii.com/widget/relatedItems.htm" style="border:0;"><img src="http://static.wumii.com/images/pixel.png" alt="无觅相关文章插件，快速提升流量" style="border:0;padding:0;margin:0;" /></a></p>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/d4c01dc675bbabaf50ed1c9e4a07f96e?s=100&amp;d=monsterid&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.wsria.com/archives/author/admin' title='咖啡兔'>咖啡兔</a></h3><p>一只咖啡兔，热爱开源，喜欢追踪、研究新技术，向往背包游……
讲究效率，坚信：“工欲善其事必先利其器”
使用Linux（Ubuntu），基于Java和jQuery开发企业RIA应用</p><p class='wpa-nomargin'><a href='http://www.wsria.com/archives/author/admin' title='More posts by 咖啡兔'>More Posts</a>  - <a href='http://www.wsria.com' title='咖啡兔'>Website</a> </p></p><img src="http://www.wsria.com/?ak_action=api_record_view&id=1238&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.wsria.com/archives/1238/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

