1

Me and my team are working on a project with a lot of modules. We are using gradle for the project and everyone is new to gradle. We have a Main parent project i.e, parent build with the details of project dependencies. We want to add the integration_test task configuration to all the modules so that we can call the command gradle integration_test. So is there any way or concept of writing the configuration in the main module and make the child projects import the same configuration.

FYI: I tried it by directly adding it to the main project but got an error saying the classpath for the files which I specified does not exists. Any help or thought would be appreciated. Thanks in advance.

  • 1
    For how to model integration tests in general, see `samples/java/withIntegrationTests` in the `gradle-all` distribution. For how to configure multiple subprojects at once, see the "multi-project builds" chapter in the [Gradle User Guide](http://gradle.org/docs/current/userguide/userguide_single.html). Executing all integration test tasks at once will then just work (`gradle integrationTest`). – Peter Niederwieser Aug 20 '14 at 01:13

1 Answers1

0

Is there a particular reason to split "integration tests" from the standard test task?

If so, you can run the same script for all subprojects from the main project's build file: https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:subproject_configuration For instance:

subprojects {
    task integrationTest {
        // whatever you need
    }
}

I am note sure if this is what you talk about in the last paragraph. If so, please attache the error message you get.

It is also possible to "import" some configuration by subprojects, but the above definition is better in most scenarios.

Marwin
  • 2,655
  • 1
  • 19
  • 17