Uberjar aborting because jar failed: duplicate entry: web/utils.cljs #366

Closed
timur-han opened this Issue Feb 10, 2015 · 8 comments

Comments

Projects
None yet
6 participants
@timur-han

Hi all,

I can compile my ClojureScripts with the following uberjar profile, i.e., "lein with-profile uberjar cljsbuild once" works fine. However whenever I try to create an uberjar, I receieve the following error and uberjar creattion fails. Do you have any idea what might be the problem?

Error:
Compiling ClojureScript.
Uberjar aborting because jar failed: duplicate entry: web/utils.cljs

Uberjar profile:

:uberjar {:local-repo "repo"
           :uberjar-name "myapp-standalone.jar"
           :hooks [leiningen.cljsbuild]
           :cljsbuild {
                       :builds [{
                                        ; The path to the top-level ClojureScript source directory:
                                 :source-paths ["src/main/cljs"]
                                 :jar true
                                        ; The standard ClojureScript compiler options:
                                        ; (See the ClojureScript compiler documentation for details.)
                                 :compiler {
                                            :output-to "src/main/web-app/public/js/main.js"  ; default: target/cljsbuild-main.js
                                            :optimizations :advanced
                                            :pretty-print false}}]}}
@cemerick

This comment has been minimized.

Show comment
Hide comment
@cemerick

cemerick Feb 19, 2015

Collaborator

Could you paste the entire project.clj?

Collaborator

cemerick commented Feb 19, 2015

Could you paste the entire project.clj?

@timur-han

This comment has been minimized.

Show comment
Hide comment
@timur-han

timur-han Feb 20, 2015

Here:

(defproject my-project "0.2.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"
:comments "same as Clojure"}
:min-lein-version "2.5.0"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.3.1"]
[liberator "0.12.2"]
[enlive "1.1.5"]
[com.novemberain/monger "2.0.0"]
[com.cemerick/friend "0.2.1"]
[friend-oauth2 "0.1.1"]
[enfocus "2.1.0"]
[http-kit "2.1.16"]
[cljs-http "0.1.25"]
[hiccup "1.0.5"]
[cljs-ajax "0.3.9"]
[com.taoensso/timbre "3.3.1"]
[org.clojure/clojurescript "0.0-2740"]
[environ "1.0.0"]
[clojure-saxon "0.9.4"]
[com.cemerick/url "0.1.1"]
[into-edn "1.0.2"]
[org.clojure/data.xml "0.0.8"]
[org.clojure/data.zip "0.1.1"]
[tailrecursion/ring-proxy "2.0.1-SNAPSHOT"]
[com.sun.jersey/jersey-core "1.17"]
[com.sun.jersey/jersey-client "1.17"]
[org.slf4j/jcl-over-slf4j "1.7.6"]
[com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider
"2.2.2"]
[com.fasterxml.jackson.core/jackson-databind "2.2.2"]];;
com

;:repositories {"local" ~(str (.toURI (java.io.File. (str (System/getenv
"project.basedir") "3rdparty-repo"))))}
;;:repositories {"project" "file:repo"}
;;:java-source-paths ["src/main/java"]
:resource-paths ["src/main/resources" "src/main/web-app"]
:source-paths ["src/main/clj"]
:ring {:handler myApp/app}
:uberjar-name "myApp-standalone.jar"
:main myApp.main
:plugins [[lein-environ "1.0.0"]]
:env {:branding "myApp",
:version "0.0.1"})

On Thu, Feb 19, 2015 at 10:38 PM, Chas Emerick notifications@github.com
wrote:

Could you paste the entire project.clj?


Reply to this email directly or view it on GitHub
#366 (comment)
.

Here:

(defproject my-project "0.2.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"
:comments "same as Clojure"}
:min-lein-version "2.5.0"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.3.1"]
[liberator "0.12.2"]
[enlive "1.1.5"]
[com.novemberain/monger "2.0.0"]
[com.cemerick/friend "0.2.1"]
[friend-oauth2 "0.1.1"]
[enfocus "2.1.0"]
[http-kit "2.1.16"]
[cljs-http "0.1.25"]
[hiccup "1.0.5"]
[cljs-ajax "0.3.9"]
[com.taoensso/timbre "3.3.1"]
[org.clojure/clojurescript "0.0-2740"]
[environ "1.0.0"]
[clojure-saxon "0.9.4"]
[com.cemerick/url "0.1.1"]
[into-edn "1.0.2"]
[org.clojure/data.xml "0.0.8"]
[org.clojure/data.zip "0.1.1"]
[tailrecursion/ring-proxy "2.0.1-SNAPSHOT"]
[com.sun.jersey/jersey-core "1.17"]
[com.sun.jersey/jersey-client "1.17"]
[org.slf4j/jcl-over-slf4j "1.7.6"]
[com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider
"2.2.2"]
[com.fasterxml.jackson.core/jackson-databind "2.2.2"]];;
com

;:repositories {"local" ~(str (.toURI (java.io.File. (str (System/getenv
"project.basedir") "3rdparty-repo"))))}
;;:repositories {"project" "file:repo"}
;;:java-source-paths ["src/main/java"]
:resource-paths ["src/main/resources" "src/main/web-app"]
:source-paths ["src/main/clj"]
:ring {:handler myApp/app}
:uberjar-name "myApp-standalone.jar"
:main myApp.main
:plugins [[lein-environ "1.0.0"]]
:env {:branding "myApp",
:version "0.0.1"})

On Thu, Feb 19, 2015 at 10:38 PM, Chas Emerick notifications@github.com
wrote:

Could you paste the entire project.clj?


Reply to this email directly or view it on GitHub
#366 (comment)
.

@lprefontaine

This comment has been minimized.

Show comment
Hide comment
@lprefontaine

lprefontaine Jun 29, 2015

Hi,

Having the same issue with .cljc files. The standard jar task runs, adding source files (.clj/.cljc) and when the cljsbuild hook is called, it tries again to add the same cljc files and this makes the jar task failed.

I had to globally disable the hook and create a specific jar profile to work around this to get the js targets in the jar.

Cljsbuild does not check that the file has not been already added ? Can it verify ?
Not having wrote a significant lein plugin yet I am not aware if this is doable or not.

Thank you

Hi,

Having the same issue with .cljc files. The standard jar task runs, adding source files (.clj/.cljc) and when the cljsbuild hook is called, it tries again to add the same cljc files and this makes the jar task failed.

I had to globally disable the hook and create a specific jar profile to work around this to get the js targets in the jar.

Cljsbuild does not check that the file has not been already added ? Can it verify ?
Not having wrote a significant lein plugin yet I am not aware if this is doable or not.

Thank you

@elliot42

This comment has been minimized.

Show comment
Hide comment

+1

@cemerick

This comment has been minimized.

Show comment
Hide comment
@cemerick

cemerick Aug 24, 2015

Collaborator

cljsbuild's hooks need to be eliminated entirely. They are semi-deprecated in Leiningen, in preference of :prep-tasks. For the use case here, eliminate the cljsbuild hook, and add this to your :uberjar profile:

:prep-tasks ["compile" ["cljsbuild" "once"]]
Collaborator

cemerick commented Aug 24, 2015

cljsbuild's hooks need to be eliminated entirely. They are semi-deprecated in Leiningen, in preference of :prep-tasks. For the use case here, eliminate the cljsbuild hook, and add this to your :uberjar profile:

:prep-tasks ["compile" ["cljsbuild" "once"]]

@cemerick cemerick closed this Aug 24, 2015

@cemerick

This comment has been minimized.

Show comment
Hide comment
@cemerick

cemerick Aug 24, 2015

Collaborator

Track #405 for the hook elimination.

Collaborator

cemerick commented Aug 24, 2015

Track #405 for the hook elimination.

@venantius

This comment has been minimized.

Show comment
Hide comment
@venantius

venantius Sep 27, 2015

Would it be possible for this recommendation to either remain as an open issue until fully resolved, or for the README / Wiki to be updated to point people in this direction? I also problems with this and only just stumbled upon this thread.

Would it be possible for this recommendation to either remain as an open issue until fully resolved, or for the README / Wiki to be updated to point people in this direction? I also problems with this and only just stumbled upon this thread.

mneise added a commit that referenced this issue Sep 28, 2015

@mneise

This comment has been minimized.

Show comment
Hide comment
@mneise

mneise Sep 28, 2015

Collaborator

Thank you for the suggestion. I've added a note about this to the README (04c06f6)

Collaborator

mneise commented Sep 28, 2015

Thank you for the suggestion. I've added a note about this to the README (04c06f6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment