我正在使用ant 1.9.0来运行我的Java项目,我有一个bat文件,它有命令ant clean compile run。clean and compile是正常的,但是对于目标运行,我得到了以下错误
C:\Users\Susanta\MyMaven\MyMavenProject\build] on class org.apache.
tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter: java.lang.NoClassDefFoundErrorjunit/framework/TestListener
我正在附加build.xml请让我知道我的build.xml中的问题
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE project [
]>
<project name="MyMavenProject" default="usage" basedir=".">
<!-- ========== Initialize Properties =================================== -->
<property environment="env"/>
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="${user.home}/.m2/repository/"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="test.reportsDir" value="${test.dest}/test_reports"/>
<path id="testcase.path">
<pathelement location="${test.dest}"/>
<fileset dir="${ws.jars}">
<include name="*.jar"/>
</fileset>
</path>
<target name="setClassPath" unless="test.classpath">
<path id="classpath_jars">
<fileset dir="${ws.jars}" includes="**/*.jar"/>
</path>
<pathconvert pathsep=":"
property="test.classpath"
refid="classpath_jars"/>
</target>
<target name="init" depends="setClassPath">
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>
</target>
<!-- all -->
<target name="all">
</target>
<!-- clean -->
<target name="clean">
<delete dir="${test.dest}"/>
</target>
<!-- compile -->
<target name="compile" depends="init, clean" >
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.dest}" includes="**/*"/>
</delete>
<echo message="making directory..."/>
<mkdir dir="${test.dest}"/>
<echo message="classpath------: ${test.classpath}"/>
<echo message="compiling..."/>
<javac
debug="true"
destdir="${test.dest}"
srcdir="${test.src}"
target="1.5"
classpath="${test.classpath}"
>
</javac>
</target>
<!-- build -->
<target name="build" depends="init">
</target>
<target name="usage">
<echo>
ant run will execute the test
</echo>
</target>
<path id="test.run">
<fileset dir="${ws.jars}" includes="**/*.jar"/>
</path>
<target name="run" >
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.reportsDir}" includes="**/*"/>
</delete>
<java jar="${ws.jars}" fork="true" spawn="true" />
<junit fork="yes" haltonfailure="no" printsummary="yes">
<classpath refid="test.run" />
<!-- <classpath ="${test.classpath}"/> -->
<batchtest todir="${test.reportsDir}" fork="true">
<fileset dir="${test.dest}">
<!--include name="tests/LoginTest.class" />
<include name="tests/Parameterized_Test.class" />
<include name="tests/TestApplication.class" /-->
<include name="com/testing/GoogleTest.class" />
<include name="com/testing/YahooTest.class" />
</fileset>
</batchtest>
<formatter type="xml" />
<classpath refid="testcase.path" />
</junit>
<junitreport todir="${test.reportsDir}">
<fileset dir="${test.reportsDir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.reportsDir}" />
</junitreport>
</target>
以下是错误:
C:\Users\Susanta\MyMaven\MyMavenProject\build] on class org.apache.
tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter: java.lang.NoClassDefF
oundError: junit/framework/TestListener
[exec] at java.lang.ClassLoader.defineClass1(Native Method)
[exec] at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
[exec] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[exec] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[exec] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
[exec] at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1385)
[exec] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoaderjava:1064)
[exec] at org.apache.tools.ant.util.SplitClassLoader.loadClass(SplitClassLoader.java:58)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
[exec] at java.lang.ClassLoader.defineClass1(Native Method)
[exec] at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
[exec] at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1128)
[exec] at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1299)
[exec] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1354)
[exec] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoaderjava:1315)
[exec] at org.apache.tools.ant.util.SplitClassLoader.loadClass(SplitClassLoader.java:52)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
[exec] at java.lang.Class.forName0(Native Method)
[exec] at java.lang.Class.forName(Class.java:266)
[exec] at
org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter(FormatterElement.java:286)
[exec] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.logVmExit(JUnitTask.java:1653)
[exec] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.logVmCrash(JUnitTask.java:1617)
[exec] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1099)
[exec] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:851)
[exec] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1899)
[exec] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:800)
[exec] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[exec] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[exec] at java.lang.reflect.Method.invoke(Method.java:601)
[exec] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[exec] at org.apache.tools.ant.Task.perform(Task.java:348)
[exec] at org.apache.tools.ant.Target.execute(Target.java:435)
[exec] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[exec] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[exec] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[exec] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[exec] at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[exec] at org.apache.tools.ant.Main.runBuild(Main.java:851)
[exec] at org.apache.tools.ant.Main.startAnt(Main.java:235)
[exec] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[exec] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[exec] Caused by: java.lang.ClassNotFoundException: junit.framework.TestListener
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
[exec] ... 48 more
[exec]
[exec] Total time: 7 seconds
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.773s
[INFO] Finished at: Mon Jul 07 03:01:39 IST 2014
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:
run (default) on project MyMavenProject: An Ant BuildException has occured: exec
returned: 1
[ERROR] around Ant part ...<exec dir="C:\Users\Susanta\MyMaven\MyMavenProject" e
xecutable="C:\Users\Susanta\MyMaven\MyMavenProject\testrunner.bat" failonerror="
true">... @ 5:142 in C:\Users\Susanta\MyMaven\MyMavenProject\target\antrun\build
-runtheapp.xml
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project MyMaven
Project: An Ant BuildException has occured: exec returned: 1
around Ant part ...<exec dir="C:\Users\Susanta\MyMaven\MyMavenProject" executabl
e="C:\Users\Susanta\MyMaven\MyMavenProject\testrunner.bat" failonerror="true">..
. @ 5:142 in C:\Users\Susanta\MyMaven\MyMavenProject\target\antrun\build-runthea
pp.xml
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException
has occured: exec returned: 1
around Ant part ...<exec dir="C:\Users\Susanta\MyMaven\MyMavenProject" executable="C:\Users\Susanta\MyMaven\MyMavenProject\testrunner.bat" failonerror="true">..
. @ 5:142 in C:\Users\Susanta\MyMaven\MyMavenProject\target\antrun\build-runtheapp.xml
这似乎是Ant 1.9.0
中的一个已知bug。参见此处:运行junit任务时BamboonAnt任务失败
阅读注释#4,#5,#8
@此链接获得一些帮助。
0信息如果它以ok结尾就可以工作1详细cli['C:\程序文件\nodejs\node.exe',1详细cli'C:\users\bhargavii nadendla\appdata\roaming\npm\node_module\npm\bin\npm-cli.js',1详细cli'run',1详细cli'build']2使用npm@6.0.1 3使用node@v8.11.2 4详细run-sc
问题内容: 我在第一条语句中有一个语法问题。 我收到以下VBA错误: 运行时错误‘3290’ 目标是根据特定列中的值将不同的数据移动到新表中。之后,将清除原始表,并且将再次插入每个不同的值。此后临时表将被删除。 此代码正在MS Excel中运行。 问题答案: 尽管不太正确,但您已经在第三条语句中具有使此功能起作用的语法。 第一行应该是 第三条声明应为:
我已经有一个名为ant-jmeter-1.1.1的文件,位于路径 。 但是,当我从同一根目录运行ant命令时,出现了一个错误: BUILD 失败的 C:\apache-jmeter-2.13\apache-jmeter-2.13\extras\build.xml:87: 参考 C:\apache-jmeter-2.13\apache-jmeter-2.13\extras\ant-jmeter-1.
我试图运行maven命令来生成项目结构,但出现以下错误: 无法解析工件,可能是由于存储库列表没有为工件的元数据适当配备。org.apache.maven.plugins: maven-arch etype-plugin: pom: 3.0.2-SNAPSHOT 我认为问题在于maven使用的是maven原型插件的3.0.2版快照,但我不知道在哪里可以更改它。我还查看了mvn搜索工件的存储库,但没有
我正在 https://github.com/oracle/visualvm 构建这个项目。我的系统中有 JDK10。我将 build xml 中的源和目标选项从 1.5 更改为 1.8,因为有错误说 1.5 不再受支持。现在,我收到一个编译错误,指向common.xml它位于其他子文件夹中。 我不知道是怎么回事,因为错误日志也很模糊。此外,我第一次与Ant合作。 这是日志。 引发错误的通用部分.
我试图使用ANT生成Eclipse Link JPA元模型 然而,我得到以下错误,这可能是什么原因? 错误的服务配置文件,或在构造处理器对象javax时引发异常。注释。处理。处理者:提供者组织。日食坚持不懈内部的jpa。modelgen。找不到CanonicalModelProcessor