title: GRADLE tasks run configuration
body: <p>I have a project that consists of two parts: Spring Boot and React.
  In my Spring Boot <code>build.gradle</code> config I specified what actions should be performed in order to build and run the application.</p>
  <p>Here is how it looks like:</p>
  <pre><code>plugins {
      id 'org.springframework.boot' version '2.2.5.RELEASE'
      id 'io.spring.dependency-management' version '1.0.9.RELEASE'
      id 'java'
    id &quot;com.github.node-gradle.node&quot; version &quot;2.2.4&quot;
  }
  
  group = 'com.vtti'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = '1.8'
  
  configurations {
      developmentOnly
      runtimeClasspath {
          extendsFrom developmentOnly
      }
  }
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.apache.poi:poi:3.10-FINAL'
      developmentOnly 'org.springframework.boot:spring-boot-devtools'
      testImplementation('org.springframework.boot:spring-boot-starter-test') {
          exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
      }
          compile 'org.apache.poi:poi:3.10-FINAL'
          compile 'org.apache.poi:poi-ooxml:3.10-FINAL'
          compile 'com.sendgrid:sendgrid-java:4.1.2'
          compile 'org.json:json:20190722'
          compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.11.0'
  }
  
  test {
      useJUnitPlatform()
  }
  
  node {
    // Version of node to use.
    version = '10.16.3'
    // Version of Yarn to use.
    yarnVersion = '1.21.1'
  
    // Base URL for fetching node distributions (change if you have a mirror).
    distBaseUrl = 'https://nodejs.org/dist'
  
    // If true, it will download node using above parameters.
    // If false, it will try to use globally installed node.
    download = true
  
    // Set the work directory for unpacking node
    workDir = file(&quot;${project.buildDir}/nodejs&quot;)
    // Set the work directory for YARN
    yarnWorkDir = file(&quot;${project.buildDir}/yarn&quot;)
    // Set the work directory where node_modules should be located
    nodeModulesDir = file(&quot;${project.projectDir}&quot;)
  }
  
  
  task appYarnInstall(type: YarnTask) {
    description = &quot;Install all dependencies from package.json&quot;
    workingDir = file(&quot;${project.projectDir}/src/main/client&quot;)
    args = [&quot;install&quot;]
  }
  
  task appYarnBuild(type: YarnTask) {
    description = &quot;Build production version of the React client&quot;
    workingDir = file(&quot;${project.projectDir}/src/main/client&quot;)
    args = [&quot;run&quot;, &quot;build&quot;]
  }
  
  task copyClient(type: Copy) {
    from 'src/main/client/build'
    // into 'build/resources/main/static/.'
    into 'src/main/resources/static/.'
  }
  
  appYarnBuild.dependsOn appYarnInstall
  copyClient.dependsOn appYarnBuild
  compileJava.dependsOn copyClient
  </code></pre>
  <p>When I run <code>gradlew build</code> everything works properly, Gradle performs <code>yarn install</code>, <code>yarn build</code>, etc.</p>
  <p>However, when I run <code>gradlew bootRun</code> and want just to compile and run a project, it performs all the <code>yarn</code> actions again and builds a new front-end, which leads in multiple &quot;changed files&quot; that are visible for git and should be committed again.</p>
  <p><strong>Is that possible to specify when tasks should be run and run them only on <code>gradlew build</code> and not on <code>gradlew bootRun</code>?</strong></p>