0
我使用ANT运行我的项目正在运行的任务,从自定义文件夹添加的hibernate.cfg.xml和log4j.properties文件,我有我的hibernate.cfg.xml
和我的自定义文件夹中的一个下log4j.properties
文件调用/config
,当我从蚂蚁运行任务时,由于hibernate.cfg.xml is not found
而失败,并显示log4j appenders warnings
。无论如何,有可能让蚂蚁在这些文件的自定义文件夹下查找,而不是将它放在src
之下。有什么办法,同时从蚂蚁
目标名称 -
<target name="controlGRID" depends="compile">
<echo>
Please wait .... GRID is starting up...
</echo>
<java classname="foo.bar.framework.selenium.SetupGrid" classpath="${test.dest}" classpathref="test.c">
<arg value="${arg}"/>
</java>
<echo>
GRID Start up complete !
</echo>
</target>
类路径 -
<target name="setClassPath" unless="test.classpath">
<path id="classpath_jars">
<fileset dir="${ws.jars}" includes="*.jar"/>
<!--<pathelement path="${foobar.config}"/>-->
<pathelement location="${foobar.config}"/>
<fileset dir="${foobar.config}">
<include name="hibernate.cfg.xml"/>
<include name="log4j.properties"/>
</fileset>
</path>
Hibernate的配置序列 -
hibernateConfig = new Configuration();
hibernateConfig.configure();
StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(hibernateConfig.getProperties());
hibernateSessionFactory = hibernateConfig.buildSessionFactory(ssrb.build());
您可以显示您正在尝试运行的示例ANT任务吗? – dg99 2015-02-11 18:15:13
请提供您认为有助于回答此问题的ant文件部分。 – CKing 2015-02-11 18:18:13
@ dg99 - 我已编辑并添加了相关示例。谢谢 – Shek 2015-02-11 18:26:11