Running a project with Gradle and TestNG


Currently I have a TestNG project that uses Gradle for the dependency management. The tests are currently ran using TestNG xml files and Idea's TestNG runner.

I've tried adding the project to TeamCity in order to get a nightly regression test running for all the TestNG tests in the project, but I can't figure out how to get it to run in TeamCity. I have one build configuration grab the current code from the master branch of the git repo and then build it using Gradle. That one works just fine and without error.

But when I try to add an Intellij IDEA Project build configuration, it fails to compile parts of the project, specifically it won't compile the JOOQ generated code that I use to access a database.

The error(s):

C:\TeamCity\buildAgent\work\3cb51db1f1141a11\src\main\java\org\jooq\db\stage\tables\records\ cannot find symbol 
  symbol:   class Field 
  location: package org.jooq 
import org.jooq.Field;

And it prints a hundred more of these for various classes in the same library.

1 comment

The problem was resolved via email. The solution is:

Gradle related files are defined in .idea/libraries/Gradle__*, these files are computer specific and are regenerated by IDEA.
To workaround the problem, you can use Gradle IDEA plugin: It generates files that are used by IntelliJ IDEA.
To use it replace the first build step with Gradle build step with task "idea": 
Thought the recommended approach is to use Gradle runner. I think you'd better ask at how to deal with running tests with Gradle.


Please sign in to leave a comment.