technomancy/leiningen — Issue #358: Duplicate entry error when creating jar file with java source files
Author: lprefontaine
Created: 2011-12-28 04:05:23+00:00
State: open

Hi,

I have this error now when using lein 1.6.2 when creating a jar file in a project containing Java source files:

lprefontaine@[boing (master)⚡] ➔ lein-jar
Build in /home/lprefontaine/workspaces/DSLs/boing
Copying 1 file to /home/lprefontaine/workspaces/DSLs/boing/lib
Compiling 1 source file to /home/lprefontaine/workspaces/DSLs/boing/classes
Compiling boing.bean
Compiling boing.context
Compiling boing.core.reflector
Compiling boing.resource
Compilation succeeded.
Compiling boing.bean
Compiling boing.context
Compiling boing.core.reflector
Compiling boing.resource
Compilation succeeded.
Exception in thread "main" java.util.zip.ZipException: duplicate entry: boing/core/Util.java (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.util.zip.ZipException: duplicate entry: boing/core/Util.java
at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:175)
at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:92)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:90)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at leiningen.jar$fn__3686.invoke(jar.clj:127)
at clojure.lang.MultiFn.invoke(MultiFn.java:172)
at leiningen.jar$write_jar.invoke(jar.clj:142)
at leiningen.jar$jar.invoke(jar.clj:210)
at leiningen.jar$jar.invoke(jar.clj:214)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:259)
at leiningen.core$_main.doInvoke(core.clj:325)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:328)
at user$eval42.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more

lein-jar does the following:

lprefontaine@[boing (master)⚡] ➔ more $(which lein-jar)
echo "Build in $(pwd)"
lein clean, deps, compile && lein jar

lprefontaine@[boing (master)⚡] ➔

And the project file is:

(defproject boing "1.2.2"
:min-lein-version "1.6.2"
:disable-implicit-clean false
:java-source-path "src"
:java-fork true
:javac-target "1.5"
:warn-on-reflection false
:target-dir "target/"
:jar-name "boing-1.2.2.jar"
:clean-non-project-classes true
:class-file-whitelist #"boing/"
:license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"
:distribution :repo
:comments "same as Clojure"}
:manifest {"Built-By" "build-manager"
"Specification-Title" "Boing library"
"Specification-Version" "1.2"
"Specification-Vendor" "SoftAddicts Inc."
"Implementation-Title" "Boing library"
"Implementation-Version"	"1.2.2"
"Implementation-Vendor" "SoftAddicts Inc."
}
:omit-source false
:aot :all
:dependencies [[org.clojure/clojure "1.2.1"]])
lprefontaine@[boing (master)⚡] ➔

When I set omit-source to true, the build completes successfully. No idea yet why the java source file is being added twice.

The project can be found on github (boing). I will push the mods before tomorrow night. I will use omit-source meanwhile.

Thanx,
Luc