When a task or configuration closure is too project-specific for the allprojects property closure in the root build.gradle script, it should be added to a sub-module’s build.gradle file instead.

All sub-modules must define their own project location along with any project compile dependencies in the build.gradle file. For example, the CommerceAccelerator/Applications/B2CStore/Base project has a compile dependency on the CommerceAccelerator/Base module:

project(":Applications:B2CStore:Base") {
  defaultTasks "all";
  description = "Project that extends all of the core CSA/Base functionality."

  dependencies {
    compile project(":Base")

    testCompile(
      files("${installationProjectPath}/src/test/java"),
    )
  }
}

For sub-modules that have WAR files, the build.gradle file should also extend the buildWar task to provide application-specific configuration for assembling the application’s WAR file. For example, the CommerceAccelerator/Applications/B2CStore module’s build.gradle file modifies the buildWar task so that it copies the contents of the CommerceAcclerator/Applications/B2CStore/src/main/web-app directory into a new store.war directory and then copies the relevant jars from the Oracle Platform to the store.war/WEB-INF/lib directory.

The defaultTasks statement specifies that, if you run the gradle command for this module without specifying a particular task, the gradle all task will run by default.


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices