2017-12-21 17 views
0

いくつかの範囲を指定するには、バージョンでカンマをサポートしていますか?いくつかの範囲を指定するために、gradleはバージョンでコンマをサポートしていますか?

評価:

dependencies { 
    compile 'org.webjars.npm:minimatch:2.+,3.+' 
} 

または:

compile 'org.webjars.npm:minimatch:[2,3),[3,4)' 

It is allowed in Maven

(1.0]、[1.2) X < = 1.0 X> = 1.2。

dependencies { 
    compile(group: 'org.webjars.npm', name: 'glob', version: '5.0.15') { 
} 

:複数のセットは、ために、このライブラリ

との組み合わせで動作しないことが知られている場合、これは1.1を除外カンマ区切り

(1.1)、(1.1) ありますGradleの依存関係を解決するためにアイビーを使用しています

Execution failed for task ':dump'. 
> Could not resolve all files for configuration ':runtime'. 
    > Could not find org.webjars.npm:minimatch:[2,3),[3,4). 
    Searched in the following locations: 
    https://repo1.maven.org/maven2/org/webjars/npm/minimatch/[2,3),[3,4)/minimatch-[2,3),[3,4).pom 
    https://repo1.maven.org/maven2/org/webjars/npm/minimatch/[2,3),[3,4)/minimatch-[2,3),[3,4).jar 
    https://jcenter.bintray.com/org/webjars/npm/minimatch/[2,3),[3,4)/minimatch-[2,3),[3,4).pom 
    https://jcenter.bintray.com/org/webjars/npm/minimatch/[2,3),[3,4)/minimatch-[2,3),[3,4).jar 
Required by: 
    project : > org.webjars.npm:glob:5.0.15 

答えて

1

私はしませんインク・グラドルはこのような複数のバージョン範囲をサポートするが、単一の範囲をサポートする。問題のトラッカーで、これが既に報告されているかどうかを検索し、そうでない場合は新しい問題を開き、最終的に修正することができます。

この問題を解決するには、複数の範囲を使用せず、単一の範囲のみを使用する最新バージョンのライブラリを使用することができます。
また、推移的な依存関係を除外して、自分自身でバージョンを含めることも、その範囲の特定のバージョンを選択する依存関係解決ルールを書き込むこともできます。

のうち1つは、globの古いバージョンを使用したいと考えている場合に役立ちます。 Gradleのは** **依存関係の解決のためにアイビーを使用していない

dependencies { 
    compile(group: 'org.webjars.npm', name: 'glob', version: '5.0.15') { 
     exclude group: 'org.webjars.npm', module: 'minimatch' 
    } 
    runtime 'org.webjars.npm:minimatch:3.+' 
} 

configurations.all { 
    resolutionStrategy.dependencySubstitution { 
     substitute module("org.webjars.npm:minimatch") with module("org.webjars.npm:minimatch:3.0.4") 
    } 
} 

configurations.all { 
    resolutionStrategy.eachDependency { 
     if ((it.requested.group == 'org.webjars.npm') && (it.requested.name == 'minimatch')) { 
      it.useTarget group: it.requested.group, name: it.requested.name, version: '3.0.4' 
     } 
    } 
} 
+1

https://github.com/gradle/gradle/issues/3869 - *バージョン範囲のリストの推移依存性がビルド* – gavenkoa

0

:それはのように失敗した

at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:105) 

とアイビーは、バージョンリストをサポートしていませんが、少なくとも私は、ドキュメント内の例を見つけることができません。

私はいつものように問題を修正:

dependencies { 
    compile(group: 'org.webjars.npm', name: 'glob', version: '5.0.15') { 
     exclude module: 'minimatch' 
    } 
    compile 'org.webjars.npm:minimatch:3.0.4' 
} 
+1

。これはIvy構文のいくつかをサポートし、Ivyリポジトリをサポートしていますが、独自の依存関係解決メカニズムを備えています。Gradleは現在複数の範囲をサポートしておらず、提案されている解決策は解決方法の1つですが、Ivyのドキュメントは適切ではなく、Ivyが依存関係の解決に使用されているという記述は間違っています。 :-) – Vampire

関連する問題