gpt4 book ai didi

java - build.xml 中出现意外的新行

转载 作者:行者123 更新时间:2023-12-01 09:52:33 25 4
gpt4 key购买 nike

我最近制作了一个 build.xml 来运行我的 java 类和测试类。但是,当我通过 ./build.xml

在 unix 中运行它时

它给了我一个错误:

./build.xml: line 1: syntax error near unexpected token `newline'
./build.xml: line 1: `<?xml version="1.0"?>'

这是我的构建文件:

<?xml version="1.0"?>
<project default='test'>
<target name='test' depends='compile'>
<junit>
<formatter type='plain'/>
<test name='gIntTest'/>
<classpath>
<pathelement path="."/>
</classpath>
</junit>
<java classname="gIntTest" classpath="." fork="true" />
</target>
<target name="compile">
<javac srcdir="." includeantruntime="false"/>
</target>
</project>

最佳答案

build.xmlAnt 运行,而不是 ./build.xml,如果您像 ./build.xml 一样运行它,那么您将作为 shellscript 运行。

build.xml 应该执行如下:

  • ant -f build.xml
  • Ant

关于java - build.xml 中出现意外的新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37516266/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com