2012-04-19 65 views
0

所以我仍然在努力遵循这样的:http://code.google.com/p/dkpro-core-asl/wiki/MyFirstDKProProject的Eclipse /蚂蚁MD5不匹配任何其他MD5

我是在坚持用很奇怪的MD5麻烦另一个地方,我不明白为什么我的Eclipse /蚂蚁计算不同的md5比md5我可以通过使用md5sum(cygwin)或Python来计算!

的Eclipse /蚂蚁消息:

BUILD FAILED 

D:\eclipseWorkspace\maven.1334761781732\branches\1.2.x\de.tudarmstadt.ukp.dkpro.core.treetagger\src\scripts\build.xml:34: The following error occurred while executing this line: 
D:\eclipseWorkspace\maven.1334761781732\branches\1.2.x\de.tudarmstadt.ukp.dkpro.core.treetagger\src\scripts\build.xml:311: The following error occurred while executing this line: 
D:\eclipseWorkspace\maven.1334761781732\branches\1.2.x\de.tudarmstadt.ukp.dkpro.core.treetagger\src\scripts\build.xml:451: MD5 checksum mismatch for [la-tagger-little-endian.par]. 
Please verify the checksum and if necessary update this script. 
Expected: f959f8633ef842f069f0331ad19dc8b4 
Actual : bde1f6a63b2c5a658ba25a8eb90832a8 

OK,这是后话可以作为文件可以在FTP已经改变,这里是蚂蚁的build.xml文件的一部分:

<target name="la"> 
    <property name="version.la" value="2011050700"/> 

    <install-model-file url="ftp://ftp.ims.uni-stuttgart.de/pub/corpora/latin-par-linux-3.2.bin.gz" 
     type="tagger" endianness="little-endian" language="la" encoding="ISO-8859-1" 
     md5="f959f8633ef842f069f0331ad19dc8b4"/> 
</target> 

里的东西只是去怪对我来说是有::使用Cygwin(AFER手动下载通过FTP与FileZilla中,二进制模式或自动的文件,当然不是ASCII)

$ md5sum latin-par-linux-3.2.bin.gz 
e77493eed28857bf93aca91c2a6e5a9b *latin-par-linux-3.2.bin.gz 

使用python:

import urllib 
import hashlib 
data = urllib.urlopen("ftp://ftp.ims.uni-stuttgart.de/pub/corpora/latin-par-linux-3.2.bin.gz").read() 
md5 = hashlib.md5() 
md5.update(data) 
print md5.hexdigest() 
e77493eed28857bf93aca91c2a6e5a9b 

def md5_for_file(filePath): 
    md5 = hashlib.md5() 
    file = open(filePath, 'rb') 
    while True: 
     data = file.read(8192) 
     if not data: 
      break 
     md5.update(data) 

    file.close() 
    return md5.hexdigest() 

print md5_for_file(r"D:\ftp.ims.uni-stuttgart.de.pub.corpora.20120419\latin-par-linux-3.2.bin.gz") 
e77493eed28857bf93aca91c2a6e5a9b 

并且还使用从幅的免费软件来计算MD5,它们都相互匹配,但比所述一个ANT计算作为不同“实际”!

回答

0

为了手动计算md5,你应该首先提取文件。

使用gunzip或7zip。

+0

好吧,你是对的我是个笨蛋。我必须提取所有内容并计算由'file =“tree-tagger”'参数指定的文件的md5! 非常感谢。我对Eclipse/Ant/Maven的东西太陌生了...... – user1340802 2012-04-19 15:43:49

0

我是DKPro核心开发人员。我们进行这些MD5检查的原因是我们在远程文件发生更改而未经通知的情况下要注意的。

您不必亲自计算MD5总和。脚本告诉你它知道哪个MD5以及它实际得到了什么。如果您希望脚本继续运行,只需更新build.xml中记录的MD5,并告诉您是“实际”的MD5。但是,您应该更新版本。

下面这段话是从我们wiki并解释这样做的理由:

并非所有的资源都通过适当的维护版本。我们观察到资源从一天到下一天都没有任何公告或版本号的增加(如果有的话)。因此,我们根据存储在build.xml文件中的MD5校验和验证所有资源。这样,我们可以注意到一个远程资源是否已经改变。发生这种情况时,我们向build.xml文件添加一个注释,指示我们何时注意到MD5更改会更新相应资源的版本。

因为我们没有每天测试build.xml文件,所以当您尝试自己打包资源时,可能会收到MD5校验和错误。如果发生这种情况,请使用文本编辑器打开build.xmlfile,找到失败的MD5校验和,更新它并更新相应资源的版本。您也可以通过DKPro Core User Group告诉我们,我们将更新build.xml文件。

Btw。本教程已改变,同时使用不同的组件,我们可以分发模型,所以这应该很少成为一个问题了。