On 28/09/2012 3:17 AM, Jesse Long wrote:
Without version ranges, how do I write a library that works with SLF4J version 1.5.*, but does not work with SLF4J 1.6.*?

Do I depend on, say, version 1.5.11? Then when a user depends on my library, and on slf4j-api directly, specifying slf4j-api version 1.6.0 in his pom, Maven will link in 1.6.0. So that is pretty useless to me. If I find a way to enforce version 1.5.11. Then I am loosing the ability to upgrade to any future version 1.5.*.

I am not sure how version ranges will help you in this case.
Your mythical user is overriding your version 1.5.* with 1.6.* so he will be in trouble using your library regardless of what you put in your dependency.

If your library is clearly documented as not being compatible with versions after 1.5.*, then the user is responsible for making sure that nothing brings in a later version of slf4j.

You had better write a big note about your restriction since most of us will just put an exclusion on your transitive dependency for slf4j and run with the version that we want.

There are not many good libraries that are not upwards compatible and it is generally safe to run with the latest version of everything. The good library authors will change the artifact name if the new version is not capable of supporting code written for the previous version.

I have yet to see a good case for version ranges and it seems that they cause these sort of discussions every year or so.

Ron
Cheers,
Jesse

On 28/09/2012 01:20, Baptiste MATHUS wrote:
+1.
Version ranges are basically just a bad practice in my experience. I mostly
don't see any interest apart from being able to see a normally passing
build suddenly going rogue because you somehow had a dependency update
somewhere in the dependency tree. (I wrote something similar in that
comment
http://www.sonatype.com/people/2012/08/download-it-all-at-once-a-maven-idea/#comment-635524577
)

So, please, Maven users, don't use them. It's like having scripts inside
your pom.xml, it might seem sexy and powerful, but it's dangerous.
Nail down a version, and upgrade explicitly when you need to and/or are
ready to. You'll be very happy that way and your build'll stay green.

Cheers



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org




--
Ron Wheeler
President
Artifact Software Inc
email: rwhee...@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to