“重复条目”使用Eclipse将Java项目导出到JAR时出错 [英] "duplicate entry" error when exporting Java project to JAR with Eclipse

查看:510
本文介绍了“重复条目”使用Eclipse将Java项目导出到JAR时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将Eclipse 3.6.1中的Java项目推出到可运行的Jar。这个以前工作正常但今天失败了,我在课程中添加了一些额外的jar。

I am trying to exort a Java project with Eclipse 3.6.1 to a runnable Jar. This used to work properly but failed today, afer I added some additional Jars to my class path.

错误是

duplicate entry: some/class.class

有趣的是,我的构建路径中的几乎任何类都有一个重复的条目。即使我没有改变任何东西。我添加的Jars不包含重复的类。

Interestingly, there is a duplicate entry for almost any class in my buildpath. Even though I did not change anything. The Jars I added do not contain duplicate classes.

问题:这是一种Eclipse bug吗?我可以看到明显的东西吗?有人有什么想法可能导致这个错误?

Question: Is this some kind of Eclipse bug? Am I ovrlooking something obvious? Does anybody have an idea what could cause this error?

干杯

推荐答案

p>您可以尝试修改行

You could try modifying the line

<jar destfile="/Volumes/resi/talosBase.jar" filesetmanifest="mergewithoutmain">

在您的构建文件中

<jar destfile="/Volumes/resi/talosBase.jar" filesetmanifest="mergewithoutmain" duplicate="preserve">

这将导致蚂蚁保留任何重复的第一个条目,忽略其余的。默认的行为是添加,所以你可以得到相同的完全限定名称的多个文件。这个参数的其他有效条目是失败,但我不认为这将有助于您。

This will cause ant to preserve the first entry of any duplicate and ignore the rest. The default behavious is "add" so you can end up with multiple files of the same fully qualified name. The other valid entry for this paramter is "fail" but I don't think that will help you here.

旧-Answer

删除您最后创建的可运行jar或手动修改生成的ant脚本,然后再创建新脚本

Delete your last created runnable jar either manually or alter the generated ant script to do so before creating a new one

这篇关于“重复条目”使用Eclipse将Java项目导出到JAR时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆