Eclipse Gradle插件:<some pom file>无法读取或不是有效的ZIP文件

Kon*_*ner 5 java eclipse gradle maven

我将Maven项目转换为Gradle,gradle init之后gradle install在控制台上成功运行.但是,在Eclipse gradle导入之后,我收到错误:

Archive for required library: '[...].gradle/caches/modules-2/files-2.1/org.apache.jena/apache-jena-libs/2.12.0/[some hash value]/apache-jena-libs-2.12.0.pom' in project 'myproject' cannot be read or is not a valid ZIP file.

现在让我感到困惑的是,这个文件不是ZIP(或JAR)文件,而是.pom文件.为什么它尝试打开POM作为ZIP,我该如何解决这个问题?

我在Arch Linux上的Eclipse 4.4 Luna上使用Gradle 2.3和Gradle IDE 3.6.3.

use*_*858 8

我最近对jboss-ejb3-1.1.5.pom有类似的问题.它看起来像是Gradle Eclipse插件中的一个错误,因为类型为pom的maven依赖项包含在.classpath文件中.我认为它应该包含.pom文件中提到的依赖项.我通过在build.gradle文件中添加hack来解决这个问题,以便在eclipse插件生成.classpath文件时不包含'.pom'文件.

eclipse {
            classpath {
                downloadSources = false;            
                // Following block of code is to remove .pom classpath entries in .classpath files 
                file {
                    whenMerged { classpath ->
                        Iterator i = classpath.entries.iterator()
                        while (i.hasNext()) {
                            org.gradle.plugins.ide.eclipse.model.ClasspathEntry classpathEntry = i.next()
                            if(classpathEntry.kind.equals('lib') && classpathEntry.path.endsWith(".pom")) {
                                println('Removing ' + classpathEntry + ' from classpath entry')
                                i.remove()
                            }
                        }
                    }
                }
            }
        }
Run Code Online (Sandbox Code Playgroud)