这是我的构建.xml文件。我已经按照我需要的特定顺序包含了jar文件(这很重要。如果没有,我会得到包裹是密封的例外(。但是我得到的类路径是:
[echo] Classpath is C:Usersaswathy_krishnaneclipse-workspaceMerckDemolibiwats-scripting-library-v1.9.jar;C:Usersaswathy_krishnaneclipse-workspaceMerckDemolibjcommander-1.27.jar;C:Usersaswathy_krishnaneclipse-workspaceMerckDemolibjson-20160810.jar;C:Usersaswathy_krishnaneclipse-workspaceMerckDemolibtessract-wrapper.jar;C:Usersaswathy_krishnaneclipse-workspaceMerckDemolibtestng-6.11.jar
我做错了什么?如何确保我的 tesseract 包装纸始终是第一个要包含的罐子?我是蚂蚁的初学者。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="main" name="MerckDemo">
<property environment="env" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.8" />
<property name="source" value="1.8" />
<property name="src.dir" location="src" />
<property name="build.dir" location="bin" />
<property name="dist.dir" location="dist" />
<property name="resources" location="resources" />
<property name="jardest" location="jardest" />
<property name="docs.dir" location="docs" />
<property name="lib" location="lib" />
<path id="build.classpath">
<fileset dir="${lib}">
<include name="tessract-wrapper.jar" />
<include name="testng-6.11.jar" />
<include name="iwats-scripting-library-v1.9.jar" />
<include name="json-20160810.jar" />
<include name="jcommander-1.27.jar" />
</fileset>
</path>
<pathconvert property="classpathProp" refid="build.classpath" />
<echo>Classpath is ${classpathProp}</echo>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${docs.dir}" />
</target>
<target name="init">
<mkdir dir="bin" />
<mkdir dir="dist" />
<mkdir dir="docs" />
</target>
<target name="compile" depends="clean,init">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" includeantruntime="false">
</javac>
</target>
<target name="docs">
<javadoc sourcepath="${src.dir}" destdir="${docs.dir}">
<fileset dir="${src.dir}">
<include name="**" />
</fileset>
</javadoc>
</target>
<target name="setproperties">
<copy file="testproperties.templete" tofile="test.properties" overwrite="true">
<filterset begintoken="@" endtoken="@">
<filter token="application_type" value="${application_type}" />
<filter token="remote_host" value="${remote_host}" />
<filter token="remote_port" value="${remote_port}" />
<filter token="testng_group" value="${testng_group}" />
<filter token="testng_package" value="${testng_package}" />
</filterset>
</copy>
</target>
<target depends="compile,setproperties" name="main">
<java classname="merck.trigger.Trigger" classpath="${build.dir}" classpathref="build.classpath" fork="true">
</java>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects" />
</project>
我尝试通过testNG运行测试,它工作正常。这是因为我按顺序优先处理我的 tesseract jar 和构建路径的导出选项卡。请帮忙。
fileset
不会导致有序集合。要对类路径定义中的元素进行排序,应改用多个<pathelement ...>
:
<path id="build.classpath">
<pathelement location="${lib}/tessract-wrapper.jar"/>
<pathelement location="${lib}/testng-6.11.jar"/>
<pathelement location="${lib}/iwats-scripting-library-v1.9.jar"/>
<pathelement location="${lib}/json-20160810.jar"/>
<pathelement location="${lib}/jcommander-1.27.jar"/>
</path>