How to get Gradle to use a classpath for tests

2,892 views
Skip to first unread message

Tim Fox

unread,
Aug 1, 2012, 4:43:44 AM8/1/12
to ve...@googlegroups.com
Here's the project https://github.com/vert-x/mod-redis

It's Thorsten's redis busmod which I am attempting to convert to a Gradle build

When you run tests ./mk test it complains it can't find classes.

I have tried to add a classpath entry to the test task but to no avail. Doesn't seem to work whatever I do.

Docs are pretty much useless.

Any ideas?

Tim Yates

unread,
Aug 1, 2012, 5:06:03 AM8/1/12
to ve...@googlegroups.com
I might be way off target here (and I'm no sort of Gradle expert), but I've been having a look to see if I can see what's wrong...

If you change the classpath line to:

  classpath << files('build/classes/main')

It gets further...  I guess you need to add this back in as it looks like the vert.x gradle plugin removes it[1]

At least it seems to recognise itself with this addition...  Now to get it to recognize the jedis client...

Tim


--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/vertx/-/pvV9_Bu8_gEJ.
To post to this group, send an email to ve...@googlegroups.com.
To unsubscribe from this group, send email to vertx+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/vertx?hl=en-GB.

Tim Yates

unread,
Aug 1, 2012, 5:11:25 AM8/1/12
to ve...@googlegroups.com
This "seems" to work for me...

test {
  classpath += files('build/classes/main')
  classpath += configurations.compile
  systemProperty 'vertx.test.timeout', 15
  systemProperty 'vertx.mods', "$projectDir/build/tmp/mod-test"
  systemProperty 'vertx.version', "$project.version"
  testLogging.showStandardStreams = true
}


Tim

Tim Fox

unread,
Aug 1, 2012, 5:12:48 AM8/1/12
to ve...@googlegroups.com
On 01/08/12 10:06, Tim Yates wrote:
> I might be way off target here (and I'm no sort of Gradle expert), but
> I've been having a look to see if I can see what's wrong...
>
> If you change the classpath line to:
>
> classpath << files('build/classes/main')
>
> It gets further... I guess you need to add this back in as it looks
> like the vert.x gradle plugin removes it[1]

Right.. this is another issue - out build is relying on brittle project
specific plugins. When we need to change things we have to clone the
gradle-plugin project, change it, push it to maven... it's horrible

IMO this is _not_ how build tools are supposed to work. Build tools
should be explicit and declarative and not rely on magic.

>
> At least it seems to recognise itself with this addition... Now to
> get it to recognize the jedis client...
>
> Tim
>
> 1:
> https://github.com/vert-x/gradle-plugin/blob/master/src/main/groovy/org/vertx/gradle/tools/plugins/VertxPlugin.groovy#L76
>
> On 1 August 2012 09:43, Tim Fox <timv...@gmail.com
> <mailto:timv...@gmail.com>> wrote:
>
> Here's the project https://github.com/vert-x/mod-redis
>
> It's Thorsten's redis busmod which I am attempting to convert to a
> Gradle build
>
> When you run tests ./mk test it complains it can't find classes.
>
> I have tried to add a classpath entry to the test task but to no
> avail. Doesn't seem to work whatever I do.
>
> Docs are pretty much useless.
>
> Any ideas?
> --
> You received this message because you are subscribed to the Google
> Groups "vert.x" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/vertx/-/pvV9_Bu8_gEJ.
> To post to this group, send an email to ve...@googlegroups.com
> <mailto:ve...@googlegroups.com>.
> To unsubscribe from this group, send email to
> vertx+un...@googlegroups.com
> <mailto:vertx%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/vertx?hl=en-GB.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "vert.x" group.
> To post to this group, send an email to ve...@googlegroups.com.
> To unsubscribe from this group, send email to
> vertx+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/vertx?hl=en-GB.


--
Tim Fox

Vert.x - effortless polyglot asynchronous application development
http://vertx.io
twitter:@timfox

Pid

unread,
Aug 1, 2012, 7:52:14 AM8/1/12
to ve...@googlegroups.com
On 01/08/2012 09:43, Tim Fox wrote:
> Here's the project https://github.com/vert-x/mod-redis
>
> It's Thorsten's redis busmod which I am attempting to convert to a
> Gradle build
>
> When you run tests ./mk test it complains it can't find classes.
>
> I have tried to add a classpath entry to the test task but to no avail.
> Doesn't seem to work whatever I do.

I expanded the build & removed 1 line.

https://github.com/vert-x/mod-redis/pull/2

I'm not sure now whether it should be there, but I think it was required
previously in other builds...


p

> Docs are pretty much useless.
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google
> Groups "vert.x" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/vertx/-/pvV9_Bu8_gEJ.
> To post to this group, send an email to ve...@googlegroups.com.
> To unsubscribe from this group, send email to
> vertx+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/vertx?hl=en-GB.


--

[key:62590808]

signature.asc
Reply all
Reply to author
Forward
0 new messages