我已经创建了一个Perl模块来提供与RNG-processing Java库Jing的接口。代码位于here。我使用[Inline::Java][3]编译和加载了一个利用jing.jar的小类,这两个类都位于java目录中,该目录通过[File::ShareDir][4]共享。运行prove -vl或dzil test时,该模块工作得很好,并且测试都通过了:
>prove -vl
t\0-use.t .............
1..1
ok 1 - use XML::Jing;
ok
t\01-validates_xml.t ..
1..3
ok 1 - successfully reads a valid RNG
ok 2 - returns nothing when XML file is valid
ok 3
ok
t\02-exceptions.t .....
1..5
ok 1 - warning for nonexistent RNG file
ok 2 - constructor returns nothing for non-existent RNG file
ok 3 - warning for bad RNG file
ok 4 - constructor returns nothing for bad RNG file
ok 5 - warning for nonexistent XML file
ok
All tests successful.
Files=3, Tests=9, 6 wallclock secs ( 0.11 usr + 0.05 sys = 0.16 CPU)
Result: PASS当使用dzil build构建发行版时,测试也会通过
dzil build
cd XML-Jing-0.x
perl Build.PL
build
build test但是,使用dzil release时,Inline::Java在尝试加载jing.jar时会崩溃。我们得到了下面这些疯狂的错误:
BEGIN failed--compilation aborted at t/01-validates_xml.t line 5.
t/01-validates_xml.t ..........
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
A problem was encountered while attempting to compile and install your InlineJava code. The command that failed was:
"C:\Program Files\Java\jdk1.7.0_21\bin\javac.exe" -deprecation -d "C:\strawberry\cpan\build\XML-Jing-0.01-Skydfp\_Inline\lib\auto\XML\Jing_706b" RNGValidator.java > cmd.out 2>&1
The build directory was:
C:\strawberry\cpan\build\XML-Jing-0.01-Skydfp\_Inline\build\XML\Jing_706b
The error message was:
error: error reading C:\strawberry\cpan\build\XML-Jing-0.01-Skydfp\blib\lib\auto\share\dist\XML-Jing\jing.jar; invalid END header (bad central directory offset)目前,我使用begin块加载jar来编辑CLASSPATH变量:
BEGIN{
use Env::Path;
my $classpath = Env::Path->CLASSPATH;
$classpath->Append(path(dist_dir('XML-Jing'),'jing.jar'));
}使用jarsigner,我验证了jar在dzil release创建的build文件夹中已损坏,但在dzil build创建的文件夹中没有损坏
在通过dzil build创建的构建中
jarsigner -verify java/jing.jar
jar is unsigned. (signatures missing or not parsable)在通过dzil release创建的构建中
jarsigner -verify java/jing.jar
jarsigner: java.util.zip.ZipException: invalid END header (bad central directory offset)总而言之,dzil release在我的共享目录中销毁了一个jar,而dzil build没有。谁能告诉我我需要做些什么才能让这个模块正常工作?
发布于 2013-05-13 15:57:52
这是个bug。这种情况经常发生,以前在dzil也发生过。
Dist-Zilla-4.300034\lib\Dist\Zilla\Dist\Builder.pm线路388
用open my $fh, '<:raw', $filename;替换open my $fh, '<', $filename;
发布于 2013-05-09 17:59:30
根据错误消息" jing.jar;invalid END header (bad central directory offset)“,我可以断定这可能是jing.jar损坏的情况。我建议您再次下载jing.jar文件,然后尝试将其放到CLASS_PATH上。下面是一个可以下载jing的链接
http://jing-trang.googlecode.com/files/jing-20091111.zip
谢谢
https://stackoverflow.com/questions/16407083
复制相似问题