0

In a gradle project I'm trying to pull in the org.neo4j.test package so I can use ImpermanentGraphDatabase for testing. I ran into this question which led me to declare my dependency like this:

testCompile group: 'org.neo4j', name: 'neo4j-kernel', version: '2.1.2', classifier: 'tests'

However, I don't see org.neo4j.test in my cache and it blows up when I try to run the test suite. For what it's worth, if I go into Intellij, it can sense that I don't have that class on my classpath and it fixes it just fine. What could I be missing in my build config? Thanks!

UPDATE:

Here is my dependency tree:

--- org.neo4j:neo4j-kernel:2.1.2
+--- org.neo4j:neo4j-primitive-collections:2.1.2
--- org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1

The weird thing is, it can't find the class when I try to build with Gradle - but when I open Intellij the helper window says :

"Add library:'Gradle:neo4j-kernel-2.1.2-tests' to classpath"

And when I click on that everything is fine.

Community
  • 1
  • 1
  • 1
    Could you give more details about: 'it blows up when I try to run the test suite.'? eg, stacktrace etc – Bill Lin Jul 03 '14 at 06:56
  • Here is the error during compilation: error: package org.neo4j.test does not exist –  Jul 04 '14 at 13:28

2 Answers2

0

In couple of gradle based projects I'm using exactly the same snippet with classifier='tests' - this works very well, see e.g. https://github.com/sarmbruster/neo4j-spock-extension/blob/master/build.gradle. (side note: this build uses compile scope instead of testCompile intentionally to export the dependencies).

Could you please paste the output of gradle dependencies for further insights.

Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97
0

I have tried your dependency without problem:

testCompile group: 'org.neo4j', name: 'neo4j-kernel', version: '2.1.2', classifier: 'tests'

Correct jar has been downloaded and used.

Could you please try:

gradle test --refesh-dependencies
Bill Lin
  • 1,145
  • 1
  • 11
  • 12
  • No luck refreshing dependencies. I opened a brand new project with the `neo4j-kernel` being the only dependency and I'm still seeing the same issue. –  Jul 04 '14 at 14:19
  • my one was downloaded into {userhome}\.gradle\caches\modules-2\metadata-2.6\descriptors\org.neo4j, maybe delete {userhome}\.gradle\caches and try again. – Bill Lin Jul 04 '14 at 14:40
  • I blew away the caches but unfortunately it didn't help. –  Jul 04 '14 at 15:01
  • Thanks for the responses! Ultimately change the score to compile did the trick. –  Jul 04 '14 at 15:11