Grails Neo4j - why is POM included as dependency?

2019-09-06 20:30发布

I'm using spring-data-neo4j and Grails. I get the following error when executing "grails test-app".

I have the following BuildConfig.groovy dependency section:

dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
    // runtime 'mysql:mysql-connector-java:5.1.29'
    // runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
    test "org.grails:grails-datastore-test-support:jar:1.0-grails-2.4"

    compile "org.springframework:spring-context:jar:4.0.6.RELEASE"
    compile "org.springframework:spring-tx:jar:4.0.6.RELEASE"
    compile "org.springframework.data:spring-data-neo4j:jar:3.2.1.RELEASE"
    compile "org.hibernate:hibernate-validator:jar:5.1.3.Final"
    compile "org.neo4j.app:neo4j-server:jar:2.1.5"
    compile "org.neo4j.app:neo4j-server:jar:static-web:2.1.5"           
}

The error is below.

| Error Unable to obtain resource from /Users/john/.m2/repository/org/neo4j/neo4j/2.1.5/neo4j-2.1.5.pom: 
| Error java.util.zip.ZipException: error in opening zip file
| Error     at java.util.zip.ZipFile.open(Native Method)
| Error     at java.util.zip.ZipFile.<init>(ZipFile.java:220)
| Error     at java.util.zip.ZipFile.<init>(ZipFile.java:150)
| Error     at java.util.jar.JarFile.<init>(JarFile.java:166)
| Error     at java.util.jar.JarFile.<init>(JarFile.java:130)
| Error     at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1006)
| Error     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:149)
| Error     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.nextElement(AntClassLoader.java:134)
| Error     at org.apache.tools.ant.util.CollectionUtils$CompoundEnumeration.nextElement(CollectionUtils.java:241)
| Error     at sun.misc.CompoundEnumeration.nextElement(CompoundEnumeration.java:61)
| Error     at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:52)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport$ExtensionMethodCache.getExtensionMethods(StaticTypeCheckingSupport.java:1847)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode(StaticTypeCheckingSupport.java:180)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode(StaticTypeCheckingSupport.java:166)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsByNameAndArguments(StaticTypeCheckingSupport.java:880)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.findMethod(StaticTypeCheckingVisitor.java:3623)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.findMethodOrFail(StaticTypeCheckingVisitor.java:3384)
| Error     at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.findMethodOrFail(StaticCompilationVisitor.java:299)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.getResultType(StaticTypeCheckingVisitor.java:3300)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:514)
| Error     at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:49)
| Error     at org.codehaus.groovy.ast.CodeVisitorSupport.visitBooleanExpression(CodeVisitorSupport.java:166)
| Error     at org.codehaus.groovy.ast.expr.BooleanExpression.visit(BooleanExpression.java:40)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitIfElse(StaticTypeCheckingVisitor.java:2955)
| Error     at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:41)
| Error     at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
| Error     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:163)
| Error     at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
| Error     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
| Error     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1622)
| Error     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:1941)
| Error     at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:1900)
| Error     at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:144)
| Error     at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:74)
| Error     at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:132)
| Error     at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:176)
| Error     at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1047)
| Error     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
| Error     at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
| Error     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
| Error     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517)
| Error     at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:59)
| Error     at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:215)
| Error     at org.codehaus.groovy.ant.Groovyc.runCompiler(Groovyc.java:1161)
| Error     at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1212)
| Error     at org.codehaus.groovy.grails.compiler.Grailsc.compile(Grailsc.java:78)
| Error     at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:827)
| Error     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
| Error     at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:483)
| Error     at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
| Error     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
| Error     at groovy.util.AntBuilder.performTask(AntBuilder.java:319)
| Error     at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:264)
| Error     at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:147)
| Error     at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:203)
| Error     at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
| Error     at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:907)
| Error     at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:884)
| Error     at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:164)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestCompiler.compileTests(GrailsProjectTestCompiler.groovy:74)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner.processTests(GrailsProjectTestRunner.groovy:392)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:483)
| Error     at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
| Error     at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error     at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
| Error     at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
| Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner$_runAllTests_closure7.doCall(GrailsProjectTestRunner.groovy:313)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:483)
| Error     at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
| Error     at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error     at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
| Error     at groovy.lang.Closure.call(Closure.java:423)
| Error     at org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForMapEntry(DefaultGroovyMethods.java:4271)
| Error     at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1408)
| Error     at org.codehaus.groovy.runtime.dgm$151.invoke(Unknown Source)
| Error     at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
| Error     at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
| Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner.runAllTests(GrailsProjectTestRunner.groovy:299)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner.runAllTests(GrailsProjectTestRunner.groovy:214)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner.runAllTests(GrailsProjectTestRunner.groovy)
| Error     at org.codehaus.groovy.grails.test.runner.GrailsProjectTestRunner$runAllTests$0.call(Unknown Source)
| Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error     at org.codehaus.groovy.grails.cli.fork.testing.ForkedGrailsTestRunner.runInstance(ForkedGrailsTestRunner.groovy:128)
| Error     at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProjectClassExecutor.run(ForkedGrailsProjectClassExecutor.groovy:74)
| Error     at org.codehaus.groovy.grails.cli.fork.testing.ForkedGrailsTestRunner.main(ForkedGrailsTestRunner.groovy:75)

EDIT:

The contents of the directory /Users/john/.m2/repository/org/neo4j/neo4j/2.1.5 are:

-rw-r--r--  1 john  staff    193 18 Nov 08:45 _remote.repositories
-rw-r--r--  1 john  staff  23962 18 Nov 08:45 neo4j-2.1.5.jar
-rw-r--r--  1 john  staff     40 18 Nov 08:45 neo4j-2.1.5.jar.sha1
-rw-r--r--  1 john  staff  11387 18 Nov 08:45 neo4j-2.1.5.pom
-rw-r--r--  1 john  staff     40 18 Nov 08:45 neo4j-2.1.5.pom.sha1

FURTHER EDIT:

I don't get this error when running "grails run-app".

FURTHER EDIT:

This appears to be related to the fact that Neo4j-server is pulling in a POM file as a dependency. Grails is then attempting to unzip this file, but as it's a POM file, it's causing the error seen.

Within neo4j-server-2.1.5.pom, there is the dependency shown below:

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>

If I delete the <type>pom</type> line in the downloaded neo4j-server-2.1.5.pom within my ~/.m2 directory, I get no error.

Why is the <type>pom</type> included, and is it necessary?

2条回答
相关推荐>>
2楼-- · 2019-09-06 21:10

I think you had a broken DNS server (e.g. in a Hotel/Hotspot) in your network when you first downloaded this (just view the neo4j-2.1.5.jar) which should be much much bigger.

Remove that maven directory and try again on a sound network connection.

查看更多
Viruses.
3楼-- · 2019-09-06 21:16

Hmmm, I've tried the solution suggested by Michael with no luck - there's something wrong with what I'm downloading. The solution was to not include the server when testing:

// BuildConfig.groovy
if (Environment.current != Environment.TEST){
    compile "org.neo4j.app:neo4j-server:jar:2.1.5"
    compile(group:"org.neo4j.app", name:"neo4j-server", version:"2.1.5", classifier:"static-web")
}

This is only a workaround the real problem (and I don't know what the real problem actually is).

查看更多
登录 后发表回答