XDoclet的build.xml写法 zz
http://gocom.primeton.com/showblogarticle.php?cat_id=all&articleId=&blogId=14478&?PHPSESSID=0d485ace30025757c7b9a22da013c1a0&page=4&PHPSESSID=1370043e8b6d902ac0f6fdc3fe7776a8
XDoclet的build.xml写法
XDoclet的build.xml写法
- <?xml version="1.0" encoding="utf-8"?>
- <project name="appgen" default="web-demo" basedir=".">
- <property file="build.properties" />
- <path id="xdoclet.classpath">
- <fileset dir="${lib}">
- <include name="**/*.jar" />
- </fileset>
- <path location="${classes}" />
- </path>
- <target name="clean">
- <delete>
- <fileset dir="${gen}">
- <include name="*.xml" />
- </fileset>
- </delete>
- </target>
- <!-- 这个target可以生成,strutsconfigxml , strutsvalidationxml ,web.xml-->
- <target name="web-demo" depends="clean,Spring-service-beans,Spring-action-beans,Spring-dao-beans">
- <taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="xdoclet.classpath" />
- <webdoclet destDir="${gen}" mergeDir="${merge}" force="false">
- <fileset dir="${src}">
- <include name="**/*Action.java" />
- <include name="**/*Form.java" />
- </fileset>
- <strutsconfigxml Version="1.2" destDir="${gen}" validateXML="true"/>
- <strutsvalidationxml destDir="${gen}" />
- <deploymentdescriptor Servletspec="2.4" destDir="${gen}" />
- </webdoclet>
- </target>
- <target name="ReplaceConfigFile" depends="web-demo">
- <copy todir="${webinf}">
- <fileset dir="${gen}">
- <include name="struts-config.xml"/>
- <include name="validation.xml"/>
- <include name="action-beans.xml"/>
- <include name="dao-beans.xml"/>
- <include name="service-beans.xml"/>
- </fileset>
- </copy>
- </target>
- <!-- 生成spring的xml文件 -->
- <target name="Spring-service-beans" description="Spring-application-beans">
- <taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" />
- <springdoclet excludedTags="@version,@author,@todo" destDir="gen" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}">
- <fileset dir="src" includes="**/*ServiceImpl.java"/>
- <springxml destinationFile="service-beans.xml" destDir="gen"/>
- </springdoclet>
- </target>
- <!-- 生成spring的xml文件 -->
- <target name="Spring-action-beans" description="Spring-servlet-beans">
- <taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" />
- <springdoclet excludedTags="@version,@author,@todo" destDir="gen" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}">
- <springxml destinationFile="action-beans.xml" destDir="gen"/>
- <fileset dir="src" includes="**/*Action.java"/>
- </springdoclet>
- </target>
- <!-- 生成spring的xml文件 -->
- <target name="Spring-dao-beans" description="Spring-servlet-beans">
- <taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" />
- <springdoclet excludedTags="@version,@author,@todo" destDir="gen" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}">
- <springxml destinationFile="dao-beans.xml" destDir="gen"/>
- <fileset dir="src" includes="**/*DAOIbatis.java"/>
- </springdoclet>
- </target>
- </project>
============================================
- /**
- * @spring.bean id="UserDAO"
- * @spring.property name="dataSource" ref="dataSource"
- * @spring.property name="sqlMapClient" ref="sqlMapClient"
- *
- * @author Conan
- *
- */
- public class UserDAOIbatis extends BaseDAOIBatis implements UserDAO {....}
-------------------------------------------
- /**
- * @spring.bean id="UserService"
- * @spring.property name="userDao" ref="UserDAO"
- *
- * @author Conan
- *
- */
- public class UserServiceImpl extends BaseManager implements UserService {...}
---------------------------------------------
- /**
- *
- * @struts.action path="/add" name="UserForm" input="/add.jsp"
- * type="org.springframework.web.struts.DelegatingActionProxy"
- * validate="true" scope="request"
- *
- * @struts.action-forward name="success" path="/success.jsp" redirect="true"
- * @struts.action-forward name="failure" path="/failure.jsp" redirect="true"
- *
- * @struts.action-form name="UserForm"
- *
- * @spring.bean
- * name="/add"
- * @spring.property
- * name="userService"
- * ref="UserService"
- *
- */
- public final class AddAction extends BaseAction {...}
------------------------------------------
- /**
- * @struts.form name="UserForm"
- */
- public class UserForm extends BaseForm{
- /**
- * @struts.validator type="required"
- * @struts.validator type="mask" msgkey="error.age"
- * @struts.validator-var name="mask" value="^[0-9]*$"
- */
- public void setAge(Integer age) {
- this.age = age;
- }
- }