Eclipse Gradle Plugin: <some pom file> cannot be read or is not a valid zip file

I converted the Maven project to Gradle with help gradle init, after which gradle installit runs successfully on the console. However, after importing the Eclipse Gradle, I get an error:

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.

What puzzles me now is that this file is not a ZIP (or JAR) file, but a .pom file. Why is he trying to open POM as ZIP and how can I fix it?

I am using Gradle 2.3 with Gradle IDE 3.6.3 on Eclipse 4.4 Luna on Arch Linux.

+4
source share
3 answers

jboss-ejb3-1.1.5.pom. Gradle Eclipse, maven pom .classpath. , , .pom. , build.gradle, ".pom", eclipse .classpath.

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()
                            }
                        }
                    }
                }
            }
        }
+7

pom

<dependency>
    <type>pom</type>
</dependency>

jar .

+1

I fixed this by removing the POM related dependencies in the project properties -> Java Build Path

he got my compilation of the project and I could debug my unit tests at least!

0
source

All Articles