ネイティブライブラリを(推移的な依存関係として)使用するSigarライブラリに依存するGradleプロジェクトがあります。これは、依存関係ツリーの関連するフラグメントです。
+--- sigar:sigar:2.0
| +--- libsigar-amd64-linux:libsigar-amd64-linux:1.0
| +--- libsigar-ia64-linux:libsigar-ia64-linux:1.0
| +--- libsigar-x86-linux:libsigar-x86-linux:1.0
| +--- sigar-amd64-winnt:sigar-amd64-winnt:1.0
| \--- sigar-x86-winnt:sigar-x86-winnt:1.0
残念ながら、Gradleはこれらがネイティブライブラリであることを認識していないようで、通常のライブラリと同じようにEclipseクラスパスに追加しますjar
。これにより、Eclipseでエラーが発生します。
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/libsigar-x86-linux/libsigar-x86-linux/1.0/so/c9af548445db750ad46e8beb3e77c58ff2315f3f/libsigar-x86-linux-1.0.so' in project 'myproject' cannot be read or is not a valid ZIP file
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/libsigar-ia64-linux/libsigar-ia64-linux/1.0/so/19d7aa37a3c40b6812a80eca518c6b81fd5c8416/libsigar-ia64-linux-1.0.so' in project 'myproject' cannot be read or is not a valid ZIP file
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/libsigar-amd64-linux/libsigar-amd64-linux/1.0/so/9481ceafe276c92327f8f3389c5e1c791eac6a81/libsigar-amd64-linux-1.0.so' in project 'myproject' cannot be read or is not a valid ZIP file
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/sigar-x86-winnt/sigar-x86-winnt/1.0/lib/1a608efcfd2e8358862b7dce02892fa98d63c97b/sigar-x86-winnt-1.0.lib' in project 'myproject' cannot be read or is not a valid ZIP file myproject
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/sigar-x86-winnt/sigar-x86-winnt/1.0/dll/14dfa28510c62eee00812e8d231f72ec69ac45b9/sigar-x86-winnt-1.0.dll' in project 'myproject' cannot be read or is not a valid ZIP file myproject
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/sigar-amd64-winnt/sigar-amd64-winnt/1.0/dll/b326449439e280c723ac45ada770a8d65a1272cc/sigar-amd64-winnt-1.0.dll' in project 'myproject' cannot be read or is not a valid ZIP file myproject
The project cannot be built until build path errors are resolved myproject
どうすればこれを修正できますか?
編集:
私は次のようにEclipseクラスパスからネイティブ依存関係を除外しようとしました:
configurations {
natives
compile.extendsFrom(natives)
}
eclipse {
classpath {
minusConfigurations += configurations.natives
...
}
}
dependencies {
...
compile("sigar:sigar:2.0")
natives("libsigar-amd64-linux:libsigar-amd64-linux:1.0")
natives("libsigar-ia64-linux:libsigar-ia64-linux:1.0")
natives("libsigar-x86-linux:libsigar-x86-linux:1.0")
natives("sigar-amd64-winnt:sigar-amd64-winnt:1.0")
natives("sigar-x86-winnt:sigar-x86-winnt:1.0")
...
}
これは部分的にしか機能しません。GradleはEclipseクラスパスにファイルを追加しなくなりましたがdll
、ファイルを追加します。so
lib
Archive for required library: '/home/ghik/.gradle/caches/artifacts-23/filestore/sigar-x86-winnt/sigar-x86-winnt/1.0/lib/1a608efcfd2e8358862b7dce02892fa98d63c97b/sigar-x86-winnt-1.0.lib' in project 'myproject' cannot be read or is not a valid ZIP file