无法在Ant中加载ZipFileSet。

huangapple go评论57阅读模式
英文:

Cannot load ZipFileSet in Ant

问题

错误javax.script.ScriptException: TypeError: 无法从Packages.org.apache.tools.ant.types.ZipFileSet加载脚本

这个错误似乎是在执行ant deploy.xml文件时出现的类型错误。代码中可能存在问题,可能是因为loadimportClass函数在不同版本的Java中有所不同。根据提供的信息,这段脚本尝试加载org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.taskdefs.Zip

在检查代码时,可能需要确认java.version属性的值,以确定加载脚本的逻辑是否正确。可能需要调整加载脚本的方法,确保在当前Java环境下正确导入所需的类。

英文:

i get a typeerror when executing the below in my ant deploy.xml file, any idea what's wrong?
This worked about two weeks ago

command:ant -f deploy.xml

ant version: 1.9.4

error:javax.script.ScriptException: TypeError: Cannot load script from Packages.org.apache.tools.ant.types.ZipFileSet

<script language="javascript"><![CDATA[
	     var version = java.lang.System.getProperty("java.version");
         if ( version.startsWith("1.8.0")) {
             load(Packages.org.apache.tools.ant.types.ZipFileSet);
             load(Packages.org.apache.tools.ant.taskdefs.Zip);
         } else {
             importClass(Packages.org.apache.tools.ant.types.ZipFileSet);
             importClass(Packages.org.apache.tools.ant.taskdefs.Zip);
		 }
         ]]>
</script>

答案1

得分: 0

使用下面的建议修复了错误。

即:

var Zip = org.apache.tools.ant.taskdefs.Zip;

https://stackoverflow.com/questions/22503100/java-8-javascript-engine-backwards-compatibility

英文:

using the suggestion below fixed the error.

i.e.

var Zip = org.apache.tools.ant.taskdefs.Zip;

https://stackoverflow.com/questions/22503100/java-8-javascript-engine-backwards-compatibility

huangapple
  • 本文由 发表于 2023年2月16日 10:28:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75467256.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定