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