java - Gradle: maven-publish with dependency version range -


i'm developing test utilities lib dependency on kotlin-stdlib. have minimal impact on project implementing lib tried use version range in published maven pom file:

<dependency>   <groupid>org.jetbrains.kotlin</groupid>   <artifactid>kotlin-stdlib</artifactid>   <version>[1.1.2,2.0)</version>   <scope>compile</scope> </dependency> 

according this

when maven encounters multiple matches version reference, uses highest matching version

the version range should allow gradle select version suit dependencies. when testing it, however, gradle selects highest verion available range, though test project specifies kotlin-stdlib:1.1.2.

$ ./gradlew example:dependencies ... +--- org.jetbrains.kotlin:kotlin-stdlib:[1.1.2] -> 1.1.4-3 |    \--- org.jetbrains:annotations:13.0 \--- se.lovef:kotlin-assert-utils:0.0-snapshot     +--- org.jetbrains.kotlin:kotlin-stdlib:[1.1.2,2.0) -> 1.1.4-3 (*) 

doesn't seem matter if use hard requirement [1.1.2] or soft requirement 1.1.2.

if use lib in android project fails:

resolved versions app (1.1.3-2) , test app (1.1.4-3) differ. see http://g.co/androidstudio/app-test-app-conflict details.

a suggested solution add resolution rule in implementing project, eg

configurations.all {     resolutionstrategy {         force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"     } } 

i not want impose on users, instead want lib to

  • use ever version available in project provided matches defined range [1.1.2,2.0)
  • use highest version matching range if project don't use kotlin-stdlib
  • fail if project dependency version don't match lib

is there can lib achieve this?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -