Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-duplicate between deps and dev-deps. #90

Closed
timcharper opened this issue Aug 5, 2010 · 7 comments
Closed

De-duplicate between deps and dev-deps. #90

timcharper opened this issue Aug 5, 2010 · 7 comments

Comments

@timcharper
Copy link

I just ran into an issue with leiningen regarding the installation of multiple versions of the same dependency. My project.clj specifies to install clj-stacktrace 1.3. However, in one of my development dependencies, clj-stacktrace 1.2 was specified as a dependency, so it got pulled in.

In the end, I ended up with two versions of clj-stacktrace, 1.2 and 1.3.

The issue was when I started up the environment, clojure ended up loading the 1.3 version of clj-stacktrace/core.clj, and the 1.2 version of clj-stacktrace/utils.clj. To make even things more strange, if I opened up the clj-stacktrace 1.3 jar, modified clj-stacktrace/utils.clj by adding a single space, saved it (which caused the timestamp to update on it), then it would cause the 1.3 version of clj-stacktrace/utils.clj to be loaded instead.

Since leiningen is a wrapper for maven, I would understand that perhaps it would be the responsibility of maven to prevent such occurrences. If it's desirable to allow multiple conflicting versions of a dependency, is there any way to enforce that the latest versions of files (latest as in the highest version number) are preferred over older versions, in order to get a predictable load order?

@timcharper
Copy link
Author

Here is a video that captures a manifestation of this issue (and offers evidence that it does indeed exist as I say it does):

http://screencast.com/t/ZmY5MjA2YjQt

@timcharper
Copy link
Author

This is likely also of interest:

Lein version:

Leiningen 1.2.0 on Java 1.6.0_20 Java HotSpot(TM) 64-Bit Server VM

Lein Jar:

$ ll ~/.m2/repository/leiningen/leiningen/1.2.0/leiningen-1.2.0-standalone.jar
-rw-r--r--  1 timcharper  wheel  6674337 Aug  5 12:25 /Users/timcharper/.m2/repository/leiningen/leiningen/1.2.0/leiningen-1.2.0-standalone.jar

@timcharper
Copy link
Author

OK... it turns out that it wasn't the fact that I had clj-stacktrace-0.1.2.jar in my lib/dev folder.. I rm'd it and the issue still manifested.

I had compiled fragments of clj-stacktrace, somehow, in my classes folder, and those pieces were taking precedence.

timcharper@timcharper:~/LMP/lt-uber/appraiser production$ ll classes/
total 16
drwxr-xr-x  15 timcharper  staff   510 Jul 28 12:18 clj_stacktrace
drwxr-xr-x   3 timcharper  staff   102 Jul 28 12:18 clojure
-rw-r--r--   1 timcharper  staff  2657 Jul 28 12:18 core$loading__4403__auto__.class
-rw-r--r--   1 timcharper  staff  1732 Jul 28 12:18 core.class
drwxr-xr-x  32 timcharper  staff  1088 Jul 28 12:18 lt
drwxr-xr-x  79 timcharper  staff  2686 Jul 28 12:18 schema_map
drwxr-xr-x  39 timcharper  staff  1326 Jul 28 12:18 somnium
timcharper@timcharper:~/LMP/lt-uber/appraiser production$ ll classes/clj_stacktrace/utils
utils$fence.class                  utils$mash$fn__1689.class          utils$quartile3.class              utils$re_without.class             utils__init.class
utils$high.class                   utils$mash.class                   utils$re_get.class                 utils$rjust.class                  
utils$loading__4403__auto__.class  utils$quartile1.class              utils$re_match_QMARK_.class        utils$zip.class      

@timcharper
Copy link
Author

when deciding whether to use a compiled class or a new source, it appears like it goes by timestamp. If the clj_stacktrace/utils.clj file is older than the compiled classes, then the compiled files are used. however, if it's newer, then the compiled files aren't used.

Somehow, version 0.1.2 clj_stacktrace/utils.clj was the only file that appears to have compiled remnants.

lein clean deletes my classes folder and would've resolved the issue for me.

In this light, it seems unwise to run lein deps without running lein clean first. A default behavior for lein deps may be to intelligently (or not intelligently) clean the classes folder everytime.

@technomancy
Copy link
Owner

While I totally agree that we need better de-duplication between dependencies and dev-dependencies, the problem you describe with class files has been fixed in Leiningen 1.4.

@timcharper
Copy link
Author

Excellent news indeed, technomancy. Thank you!

@technomancy
Copy link
Owner

The profiles functionality in 2.0 takes care of this.

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

No branches or pull requests

2 participants