hibernate工具,ant,freemarker输出编码

时间:2011-10-27 10:18:21

标签: hibernate encoding ant freemarker

我在下面使用了ant.build.xml的hibernate工具。 它的输出文件编码是gbk,我想设置编码utf-8?怎么样?感谢。

<?xml version="1.0" encoding="UTF-8"?>
<project name="hibernate tools" default="generate.code" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
    <property name="test" value="target/gen/" />
    <property name="src.dir" value="${test}src/main/" />
    <property name="hibernatetools-templates.path" value="src/main/resources/templates" />
    <artifact:dependencies pathId="toolslib">
    <pom file="pom.xml" />
    </artifact:dependencies>
    <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />
    <target name="generate.code">
        <hibernatetool destdir="${src.dir}" templatepath="${hibernatetools-templates.path}/">
            <classpath>
                <path location="src/main/resources/" />
            </classpath>
            <property propertyFile="src/main/resources/freemarker.properties"/>     
            <jdbcconfiguration configurationfile="src/main/resources/hibernate.cfg.xml" revengfile="src/main/resources/hibernate.reveng.xml" detectmanytomany="true" namingstrategy="org.hibernate.cfg.ImprovedNamingStrategy" reversestrategy="org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy" />
            <hbmtemplate templateprefix="pojo/" template="pojo/Pojo.ftl" filepattern="java/{package-name}/{class-name}.java">
                <property key="jdk5" value="true" />
                <property key="ejb3" value="true" />
            </hbmtemplate>
        </hibernatetool>
    </target>
</project>

0 个答案:

没有答案