mguymon / lock_jar

LockJar manages Java Jars for Ruby
http://mguymon.github.io/lock_jar/
Apache License 2.0
46 stars 9 forks source link

Duplicate JARs between compile & test groups #2

Closed chetan closed 11 years ago

chetan commented 12 years ago

If you specify a JAR explicitly which is then also required via some transitive dependency in a different group, then it's possible for a duplicate to be created, potentially with a different version. I created a simple test case which shows this behavior (tested against latest version 0.6.2):

https://gist.github.com/3840692

mguymon commented 12 years ago

Right now the dependencies for scopes are generated independently of each other, which does not really make sense for the test scope.

Scopes are going away, they are a Mavenish that really does not fit with Ruby. They will be replaced with Groups, which will allow arbitrary groupings of dependencies. Jars not set in a Group are added to the default Group and are automatically added to other Groups:

repository 'http://mirrors.ibiblio.org/pub/mirrors/maven2'
repository "https://repository.cloudera.com/content/repositories/releases/"

jar 'org.slf4j:slf4j-api:jar:1.6.4'

group 'test' do
   jar "org.apache.hadoop:hadoop-test:jar:0.20.2-cdh3u5"
end

So slf4j would be part of the default Group and gets automatically added to the Group test for resolution

chetan commented 12 years ago

Yeah, I think that makes a lot of sense. I can't really think of a case where "compile" should be isolated away from "test" anyway.

In the meantime, I made an attempt at a brute force solution here -

https://github.com/chetan/lock_jar/commit/0e883556d49304fba12f06a2acbff4397288f705

mguymon commented 12 years ago

This is what I am kicking around with for the new lockfile: https://github.com/mguymon/lock_jar/wiki/LockFile

chetan commented 12 years ago

I'm not sure I follow the mixing of gems & jars. I guess this is to be able to maintain a single dependency file for a JRuby project?

Seeing where a particular dependency is being pulled in from is definitely useful, especially when you have deeply nested transitive deps pulling stuff in. The new format looks good to me.

mguymon commented 11 years ago

Want to help me out? Can you try your buildr setup with the new lockfile?

https://github.com/mguymon/lock_jar/tree/new_bundler

chetan commented 11 years ago

Yeah, I'll give it a go when I have some more time, probably tonight/tomorrow.