无法使用 ANT 编译项目
Can not compile project with ANT
我正在尝试使用以下方法编译项目:
- 蚂蚁编译
我在终端中收到以下错误:
taskdef class org.testng.TESTNGNGAntTask cannot be found
using the classloader AntClassLoader[]
这是来自 build.xml 文件的我的 teskdef
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TESTNGNGAntTask" />
你能包含 ant 文件吗(默认命名为 build.xml)?
确保您已经在计算机中安装了 Apache Ant:打开命令行并执行 ant -v。如果出现版本信息 可以使用了。
如果找到 ant 文件,请包含一个编译目标(或者如果有,修改它),如下所示:
<property name="src" location="src" />
<property name="build" location="build" />
<target name="compile">
<mkdir dir="${build}" />
<javac srcdir="${src}" destdir="${build}" />
</target>
属性只是常量。
祝你好运!
class的名字是TestNGAntTask
(有一个NG
,只有Test
的T
大写),not TESTNGNGAntTask
(有两个 NG
和一个完全大写的 TEST
)。
请尝试以下操作:
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TestNGAntTask" />
我正在尝试使用以下方法编译项目:
- 蚂蚁编译
我在终端中收到以下错误:
taskdef class org.testng.TESTNGNGAntTask cannot be found using the classloader AntClassLoader[]
这是来自 build.xml 文件的我的 teskdef
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TESTNGNGAntTask" />
你能包含 ant 文件吗(默认命名为 build.xml)?
确保您已经在计算机中安装了 Apache Ant:打开命令行并执行 ant -v。如果出现版本信息 可以使用了。
如果找到 ant 文件,请包含一个编译目标(或者如果有,修改它),如下所示:
<property name="src" location="src" />
<property name="build" location="build" />
<target name="compile">
<mkdir dir="${build}" />
<javac srcdir="${src}" destdir="${build}" />
</target>
属性只是常量。
祝你好运!
class的名字是TestNGAntTask
(有一个NG
,只有Test
的T
大写),not TESTNGNGAntTask
(有两个 NG
和一个完全大写的 TEST
)。
请尝试以下操作:
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TestNGAntTask" />