0

Normally, I'd declare a test dependency in BuildConfig.groovy for the test scope and know it'll only be in the classpath for testing, and not packaged into the deployed application:

test "org.seleniumhq.selenium:selenium-htmlunit-driver:2.27.0"

I have another JAR I'd like to include at test time, but it's not available in a maven repository, so I can't declare a dependency like I normally would.

How can I add the JAR to my project, check it in, but declare it only available at test time?

I'm currently working in Grails 2.1.1, but 2.3.x is in the future.

Thanks.

tim_yates
  • 167,322
  • 27
  • 342
  • 338
John Flinchbaugh
  • 2,338
  • 1
  • 17
  • 20

1 Answers1

2

I'm pretty sure that all jars in the lib folder are compile scoped, so you cannot change it to test.

What you can do is exclude them in the build process, using the config grails.war.resources in BuildConfig.groovy:

// Remove the JDBC jar before the war is bundled
grails.war.resources = { stagingDir ->
  delete(file:"${stagingDir}/WEB-INF/lib/jdbc2_0-stdext.jar")
}

This was taken from the Palmer's post.