文件在另一个地方。
ant
<target name="ibator-all" description="Generate the files"> <echo message="${basedir}/../devit-dev-util/dist/devit-dev-util.jar"></echo> <path id="ibator-lib"> <pathelement location="\eclipse-galileo-3.5.2\dropins\ibator-1.2.2\plugins\org.apache.ibatis.ibator.core_1.2.2.201106071209.jar"/> </path> <taskdef name="ibator" classname="org.apache.ibatis.ibator.ant.IbatorAntTask" classpathref="ibator-lib" /> <ibator overwrite="true" configfile="${basedir}/ibator-config-ant.xml" verbose="true" contextids="${contextids}"> <propertyset> <propertyref name="generated.source.dir" /> </propertyset> </ibator> </target>代码方式
import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; public class IbatorConfigTest { @BeforeClass public static void setUpBeforeClass() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void test1() throws Exception{ List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File("test/ibator-config-ant.xml"); IbatorConfigurationParser cp = new IbatorConfigurationParser(warnings); IbatorConfiguration config = cp.parseIbatorConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); Ibator ibator = new Ibator(config, callback, warnings); ibator.generate(null); for (String string : warnings) { System.out.println(string); } } }
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="" userId="" password="" > <property name="remarks" value="true"/> </jdbcConnection>